{
  "openapi": "3.1.0",
  "info": {
    "title": "Nixflex public API",
    "version": "1.0.0",
    "description": "Nixflex API reference for agents, calls, messaging, knowledge, organisations and integrations. Authenticate with the owning account and follow each operation’s permissions, response and retry contract."
  },
  "servers": [
    {
      "url": "https://api.nixflex.com/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/organisation": {
      "get": {
        "operationId": "organisationContext",
        "summary": "Get organisation context",
        "description": "Read the organisation selected by the authenticated credential. The result includes current permissions and identity fields, without a signing secret or balance. ",
        "tags": [
          "Organisation"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "organisation_id": {
                      "type": "string",
                      "description": "UUID identifier.",
                      "format": "uuid"
                    },
                    "key_id": {
                      "type": "string",
                      "description": "Account key ID, not the secret."
                    },
                    "name": {
                      "type": "string",
                      "description": "Business name."
                    },
                    "role": {
                      "type": "string",
                      "description": "Current personal role. API-key authority is owner.",
                      "enum": [
                        "owner",
                        "admin",
                        "member"
                      ]
                    },
                    "user_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UUID identifier.",
                      "format": "uuid"
                    },
                    "membership_version": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Personal membership version; null for an API key."
                    },
                    "joined_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "The account is active.",
                      "const": true
                    },
                    "dashboard_state": {
                      "type": "string",
                      "description": "Active account state.",
                      "const": "active"
                    },
                    "permissions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "Role permission name."
                      },
                      "description": ""
                    }
                  },
                  "required": [
                    "organisation_id",
                    "key_id",
                    "name",
                    "role",
                    "user_id",
                    "membership_version",
                    "joined_at",
                    "is_active",
                    "dashboard_state",
                    "permissions"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "organisation_id": "11111111-1111-4111-8111-111111111111",
                  "key_id": "example-account",
                  "name": "Example team",
                  "role": "owner",
                  "user_id": null,
                  "membership_version": null,
                  "joined_at": null,
                  "is_active": true,
                  "dashboard_state": "active",
                  "permissions": [
                    "activity",
                    "billing",
                    "close",
                    "key",
                    "normal",
                    "team",
                    "transfer",
                    "write"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/organisation/members": {
      "get": {
        "operationId": "organisationMembers",
        "summary": "List organisation members",
        "description": "Read active members, up to 100 pending or expired invitations, and current safety limits. The Owner and Admin can view the team; Members cannot. ",
        "tags": [
          "Organisation"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "members": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "user_id": {
                            "type": "string",
                            "description": "UUID identifier.",
                            "format": "uuid"
                          },
                          "email": {
                            "type": "string",
                            "description": "Member email."
                          },
                          "name": {
                            "type": "string",
                            "description": "Display name; may be empty."
                          },
                          "role": {
                            "type": "string",
                            "description": "Current personal role. API-key authority is owner.",
                            "enum": [
                              "owner",
                              "admin",
                              "member"
                            ]
                          },
                          "joined_at": {
                            "type": "string",
                            "description": "UTC timestamp.",
                            "format": "date-time"
                          },
                          "last_active_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "UTC timestamp.",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "user_id",
                          "email",
                          "name",
                          "role",
                          "joined_at",
                          "last_active_at"
                        ],
                        "additionalProperties": false,
                        "description": ""
                      },
                      "description": "Active members, ordered by join time."
                    },
                    "invites": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "UUID identifier.",
                            "format": "uuid"
                          },
                          "email": {
                            "type": "string",
                            "description": "Invited email."
                          },
                          "role": {
                            "type": "string",
                            "description": "Current personal role. API-key authority is owner.",
                            "enum": [
                              "owner",
                              "admin",
                              "member"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "description": "Pending rows whose expiry passed are displayed as expired.",
                            "enum": [
                              "pending",
                              "expired"
                            ]
                          },
                          "delivery": {
                            "type": "string",
                            "description": "Delivery status.",
                            "enum": [
                              "pending",
                              "sent",
                              "failed",
                              "unknown"
                            ]
                          },
                          "expires_at": {
                            "type": "string",
                            "description": "UTC timestamp.",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "id",
                          "email",
                          "role",
                          "state",
                          "delivery",
                          "expires_at"
                        ],
                        "additionalProperties": false,
                        "description": ""
                      },
                      "description": "Up to 100 rows, newest first; no cursor.",
                      "maxItems": 100
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "members": {
                          "type": "integer",
                          "description": "Maximum active members plus unexpired pending invitations."
                        },
                        "invites_per_day": {
                          "type": "integer",
                          "description": "Daily invitation limit."
                        },
                        "invites_used_today": {
                          "type": "integer",
                          "description": "Invitations used today in UTC."
                        },
                        "seats_used": {
                          "type": "integer",
                          "description": "Active members plus unexpired pending invitations."
                        }
                      },
                      "required": [
                        "members",
                        "invites_per_day",
                        "invites_used_today",
                        "seats_used"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "members",
                    "invites",
                    "limits"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "members": [],
                  "invites": [],
                  "limits": {
                    "members": 50,
                    "invites_per_day": 20,
                    "invites_used_today": 0,
                    "seats_used": 0
                  }
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/organisation/invites": {
      "post": {
        "operationId": "organisationInvite",
        "summary": "Invite a teammate",
        "description": "Send a 24-hour team invitation. The invited person accepts using their own verified login. Opening an email does not accept the invitation. Delivery can be sent, failed or unknown. A sent receipt confirms email-provider acceptance only. If delivery is uncertain, read the team list before deciding whether to resend. Never accept an invitation using the shared API key.",
        "tags": [
          "Organisation"
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "UUID identifier.",
                          "format": "uuid"
                        },
                        "delivery": {
                          "type": "string",
                          "description": "Email submission outcome; sent is not inbox delivery.",
                          "enum": [
                            "sent",
                            "failed",
                            "unknown"
                          ]
                        },
                        "expires_in": {
                          "type": "integer",
                          "description": "Invitation lifetime in seconds.",
                          "const": 86400
                        }
                      },
                      "required": [
                        "id",
                        "delivery",
                        "expires_in"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "UUID identifier.",
                          "format": "uuid"
                        },
                        "delivery": {
                          "type": "string",
                          "description": "Stored delivery status.",
                          "enum": [
                            "pending",
                            "sent",
                            "failed",
                            "unknown"
                          ]
                        },
                        "created": {
                          "type": "boolean",
                          "description": "An existing receipt was returned without a new invitation.",
                          "const": false
                        }
                      },
                      "required": [
                        "id",
                        "delivery",
                        "created"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  ]
                },
                "example": {
                  "id": "11111111-1111-4111-8111-111111111111",
                  "delivery": "sent",
                  "expires_in": 86400
                }
              }
            }
          },
          "400": {
            "description": "invalid_invite: The body email or role is missing or invalid. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "409": {
            "description": "invalid_invite: The normalised email is not valid. organisation_membership_conflict: This identity already belongs to an account or the account is already claimed. invite_already_pending: An unexpired invitation already exists. organisation_member_limit: The organisation seat limit has been reached. organisation_invite_limit: The daily invitation limit has been reached. organisation_owner_required: The API-only organisation must first be claimed by a verified Owner. organisation_already_member: The email is already a member of this organisation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "Invited email; trimmed and lowercased by the service.",
                    "maxLength": 254
                  },
                  "role": {
                    "type": "string",
                    "description": "Required team role; owner is not accepted.",
                    "enum": [
                      "admin",
                      "member"
                    ]
                  }
                },
                "required": [
                  "email",
                  "role"
                ],
                "additionalProperties": false,
                "description": ""
              }
            }
          }
        }
      }
    },
    "/organisation/invites/{id}/resend": {
      "post": {
        "operationId": "organisationResend",
        "summary": "Resend a team invitation",
        "description": "Invalidate the old invitation and send a replacement with a new ID and 24-hour link. Resending uses the daily invitation quota again. Delivery can be sent, failed or unknown. A sent receipt confirms email-provider acceptance only. If delivery is uncertain, read the team list before deciding whether to resend. Never accept an invitation using the shared API key.",
        "tags": [
          "Organisation"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "UUID identifier.",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "UUID identifier.",
                          "format": "uuid"
                        },
                        "delivery": {
                          "type": "string",
                          "description": "Email submission outcome; sent is not inbox delivery.",
                          "enum": [
                            "sent",
                            "failed",
                            "unknown"
                          ]
                        },
                        "expires_in": {
                          "type": "integer",
                          "description": "Invitation lifetime in seconds.",
                          "const": 86400
                        }
                      },
                      "required": [
                        "id",
                        "delivery",
                        "expires_in"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "UUID identifier.",
                          "format": "uuid"
                        },
                        "delivery": {
                          "type": "string",
                          "description": "Stored delivery status.",
                          "enum": [
                            "pending",
                            "sent",
                            "failed",
                            "unknown"
                          ]
                        },
                        "created": {
                          "type": "boolean",
                          "description": "An existing receipt was returned without a new invitation.",
                          "const": false
                        }
                      },
                      "required": [
                        "id",
                        "delivery",
                        "created"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  ]
                },
                "example": {
                  "id": "11111111-1111-4111-8111-111111111111",
                  "delivery": "sent",
                  "expires_in": 86400
                }
              }
            }
          },
          "400": {
            "description": "invalid_id: The path ID is not a UUID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "409": {
            "description": "organisation_membership_conflict: This identity already belongs to an account or the account is already claimed. invite_already_pending: An unexpired invitation already exists. organisation_member_limit: The organisation seat limit has been reached. organisation_invite_limit: The daily invitation limit has been reached. organisation_owner_required: The API-only organisation must first be claimed by a verified Owner. organisation_already_member: The email is already a member of this organisation. invite_unavailable: No invitation with this ID belongs to the organisation. invite_already_accepted: The invitation has already been accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/organisation/invites/{id}": {
      "delete": {
        "operationId": "organisationRevoke",
        "summary": "Revoke a team invitation",
        "description": "Revoke a pending or expired invitation before it is accepted. This invalidates its link; it does not remove an existing teammate. ",
        "tags": [
          "Organisation"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "UUID identifier.",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "UUID identifier.",
                      "format": "uuid"
                    },
                    "email": {
                      "type": "string",
                      "description": "Invited email."
                    },
                    "role": {
                      "type": "string",
                      "description": "Current personal role. API-key authority is owner.",
                      "enum": [
                        "owner",
                        "admin",
                        "member"
                      ]
                    },
                    "state": {
                      "type": "string",
                      "description": "Resulting invitation state.",
                      "const": "revoked"
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "role",
                    "state"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "id": "11111111-1111-4111-8111-111111111111",
                  "email": "person@example.com",
                  "role": "member",
                  "state": "revoked"
                }
              }
            }
          },
          "400": {
            "description": "invalid_id: The path ID is not a UUID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "409": {
            "description": "invite_unavailable: No invitation with this ID belongs to the organisation. invite_already_accepted: The invitation has already been accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/organisation/members/{id}": {
      "delete": {
        "operationId": "organisationRemove",
        "summary": "Remove an organisation member",
        "description": "Remove one non-Owner member from this organisation. Shared work and the shared API key remain. A successful response does not always confirm live disconnection. A 200 response has live_disconnect_pending=false. A 202 response means the membership change committed but live disconnection remains unconfirmed. Neither status promises AI hand-back or ends an ongoing human call. Recheck access and current membership before retrying.",
        "tags": [
          "Organisation"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "UUID identifier.",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "string",
                      "description": "UUID identifier.",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "description": "Resulting membership state.",
                      "const": "removed"
                    },
                    "live_disconnect_pending": {
                      "type": "boolean",
                      "description": "True when the membership change committed but live disconnection is unconfirmed."
                    }
                  },
                  "required": [
                    "user_id",
                    "state",
                    "live_disconnect_pending"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "user_id": "11111111-1111-4111-8111-111111111111",
                  "state": "removed",
                  "live_disconnect_pending": false
                }
              }
            }
          },
          "202": {
            "description": "Membership changed; live disconnection is unconfirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "string",
                      "description": "UUID identifier.",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "description": "Resulting membership state.",
                      "const": "removed"
                    },
                    "live_disconnect_pending": {
                      "type": "boolean",
                      "description": "True when the membership change committed but live disconnection is unconfirmed."
                    }
                  },
                  "required": [
                    "user_id",
                    "state",
                    "live_disconnect_pending"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "user_id": "11111111-1111-4111-8111-111111111111",
                  "state": "removed",
                  "live_disconnect_pending": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_id: The path ID is not a UUID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "409": {
            "description": "membership_unavailable: The target is not an active member. last_owner: The Owner cannot be removed or demoted through this route.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "organisationRole",
        "summary": "Change an organisation role",
        "description": "Change a non-Owner member to Admin or Member. Only Owner authority may change roles. This is not an ownership transfer. A 200 response has live_disconnect_pending=false. A 202 response means the membership change committed but live disconnection remains unconfirmed. Neither status promises AI hand-back or ends an ongoing human call. Recheck access and current membership before retrying.",
        "tags": [
          "Organisation"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "UUID identifier.",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "string",
                      "description": "UUID identifier.",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "description": "Resulting membership state.",
                      "const": "active"
                    },
                    "live_disconnect_pending": {
                      "type": "boolean",
                      "description": "True when the membership change committed but live disconnection is unconfirmed."
                    }
                  },
                  "required": [
                    "user_id",
                    "state",
                    "live_disconnect_pending"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "user_id": "11111111-1111-4111-8111-111111111111",
                  "state": "active",
                  "live_disconnect_pending": false
                }
              }
            }
          },
          "202": {
            "description": "Membership changed; live disconnection is unconfirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "string",
                      "description": "UUID identifier.",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "description": "Resulting membership state.",
                      "const": "active"
                    },
                    "live_disconnect_pending": {
                      "type": "boolean",
                      "description": "True when the membership change committed but live disconnection is unconfirmed."
                    }
                  },
                  "required": [
                    "user_id",
                    "state",
                    "live_disconnect_pending"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "user_id": "11111111-1111-4111-8111-111111111111",
                  "state": "active",
                  "live_disconnect_pending": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_id: The path ID is not a UUID. invalid_role: Choose admin or member. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "409": {
            "description": "membership_unavailable: The target is not an active member. last_owner: The Owner cannot be removed or demoted through this route.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "description": "New role; owner is not allowed.",
                    "enum": [
                      "admin",
                      "member"
                    ]
                  }
                },
                "required": [
                  "role"
                ],
                "additionalProperties": false,
                "description": ""
              }
            }
          }
        }
      }
    },
    "/organisation/activity": {
      "get": {
        "operationId": "organisationActivity",
        "summary": "List organisation activity",
        "description": "Read current organisation activity, newest first. JSON pages contain up to 50 events. Owner and Admin personal sessions can read activity. The from date must precede the exclusive day after to and cannot be in the future. Dates must be real YYYY-MM-DD dates. CSV uses 500-row chunks and streams the full matching result; 500 is not a total export limit. Permissions are checked for every chunk. An interrupted download is incomplete. CSV columns are When, Action and Result. Use the date filters for a streamed CSV export. Activity IDs are strings. Use the cursor returned by the activity read.\n\nFor CSV, Node uses organisation.activityCsv and Python uses organisation.activity_csv as byte iterators; the CLI uses organisation activityCsv --set from=2026-10-01 --set to=2026-10-31 --output activity.csv. The CLI publishes only a completed new file and never overwrites. Discard partial SDK output on failure. CSV is not an MCP tool.",
        "tags": [
          "Organisation"
        ],
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Decimal event cursor.",
              "pattern": "^\\d{1,18}$"
            }
          },
          {
            "name": "actor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Filter by person UUID.",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Inclusive UTC start day; clamped to retained activity, at most 12 months.",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Inclusive UTC end day; capped at now.",
              "format": "date"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Use csv for a streamed export; other values keep JSON. The examples use JSON."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Decimal event ID. Treat as an opaque string."
                          },
                          "created_at": {
                            "type": "string",
                            "description": "UTC timestamp.",
                            "format": "date-time"
                          },
                          "actor_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "UUID identifier.",
                            "format": "uuid"
                          },
                          "actor": {
                            "type": "string",
                            "description": "Human-readable actor label."
                          },
                          "sentence": {
                            "type": "string",
                            "description": "Human-readable action sentence."
                          },
                          "result": {
                            "type": "string",
                            "description": "Displayed outcome.",
                            "enum": [
                              "Done",
                              "Not allowed",
                              "Not confirmed"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "created_at",
                          "actor_id",
                          "actor",
                          "sentence",
                          "result"
                        ],
                        "additionalProperties": false,
                        "description": ""
                      },
                      "description": "Up to 50 events.",
                      "maxItems": 50
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as before on the next JSON request; null when no full page remains."
                    }
                  },
                  "required": [
                    "events",
                    "next_cursor"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "events": [],
                  "next_cursor": null
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                },
                "example": "When,Action,Result\r\n"
              }
            }
          },
          "400": {
            "description": "invalid_filter: An activity cursor, actor or date filter is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/organisation/claim-invite": {
      "post": {
        "operationId": "organisationClaim",
        "summary": "Request an owner claim",
        "description": "Start an email invitation to claim this existing, unclaimed API-only account. The verified recipient must accept using their own personal login; this does not create an account or new credit. Delivery can be sent, failed or unknown. A sent receipt confirms email-provider acceptance only. If delivery is uncertain, read the team list before deciding whether to resend. Never accept an invitation using the shared API key.",
        "tags": [
          "Organisation"
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "UUID identifier.",
                          "format": "uuid"
                        },
                        "delivery": {
                          "type": "string",
                          "description": "Email submission outcome; sent is not inbox delivery.",
                          "enum": [
                            "sent",
                            "failed",
                            "unknown"
                          ]
                        },
                        "expires_in": {
                          "type": "integer",
                          "description": "Invitation lifetime in seconds.",
                          "const": 86400
                        }
                      },
                      "required": [
                        "id",
                        "delivery",
                        "expires_in"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "UUID identifier.",
                          "format": "uuid"
                        },
                        "delivery": {
                          "type": "string",
                          "description": "Stored delivery status.",
                          "enum": [
                            "pending",
                            "sent",
                            "failed",
                            "unknown"
                          ]
                        },
                        "created": {
                          "type": "boolean",
                          "description": "An existing receipt was returned without a new invitation.",
                          "const": false
                        }
                      },
                      "required": [
                        "id",
                        "delivery",
                        "created"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  ]
                },
                "example": {
                  "id": "11111111-1111-4111-8111-111111111111",
                  "delivery": "sent",
                  "expires_in": 86400
                }
              }
            }
          },
          "400": {
            "description": "invalid_invite: The body email or role is missing or invalid. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "409": {
            "description": "invalid_invite: The normalised email is not valid. organisation_membership_conflict: This identity already belongs to an account or the account is already claimed. invite_already_pending: An unexpired invitation already exists. organisation_member_limit: The organisation seat limit has been reached. organisation_invite_limit: The daily invitation limit has been reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "Invited email; trimmed and lowercased by the service.",
                    "maxLength": 254
                  }
                },
                "required": [
                  "email"
                ],
                "additionalProperties": false,
                "description": ""
              }
            }
          }
        }
      }
    },
    "/organisation/signing-secret": {
      "get": {
        "operationId": "organisationSigningSecret",
        "summary": "Get the signing secret",
        "description": "Read the organisation signing secret server-side with the organisation key, or as the dashboard Owner. One secret verifies signed events for the organisation. Keep the response in private storage.",
        "tags": [
          "Organisation"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "signing_secret": {
                      "type": "string",
                      "description": "Private organisation signing secret. Independent of API-key rotation."
                    }
                  },
                  "required": [
                    "signing_secret"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "signing_secret": "REDACTED_EXAMPLE_ONLY"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/calls/history": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Get call history",
        "description": "Read a filtered call-history envelope with matching totals. History includes failed starts and omits transcripts, event data, extracted data and recording URLs. Order is created_at descending, nulls last, then row ID descending. The cursor binds the account, filters and first-page time boundary. Send only cursor and optional limit for the next page. Stop when has_more is false and next_cursor is null; stop on a repeated cursor. This is not a frozen database snapshot: later updates and deletion can change results.\n\nThe default period is the preceding 30 days. Cost sums include only known values; cost_unknown counts rows excluded from that sum. Null success is not a failed call. outcome=failed selects failed starts; their IDs can begin failed:. A retained call_summary can still be present, so treat the result as private account data.\n\n<span id=\"history-without-changing-old-clients\"></span>\n<span id=\"recording-status-and-download\"></span>\n<span id=\"kits\"></span>\nFor recording availability and temporary download access, use [Get a call recording](/api-reference/calls/get-calls-id-recording).",
        "operationId": "callHistory",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Strict integer page size; signs, fractions and leading zeros are refused.",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Strict integer page size; signs, fractions and leading zeros are refused."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Offset for the first page only. Prefer the returned cursor for continuation.",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            },
            "description": "Offset for the first page only. Prefer the returned cursor for continuation."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Opaque continuation cursor, up to 4096 characters. With cursor, send only limit; do not repeat filters or a nonzero offset.",
              "maxLength": 4096
            },
            "description": "Opaque continuation cursor, up to 4096 characters. With cursor, send only limit; do not repeat filters or a nonzero offset."
          },
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Filter by direction.",
              "enum": [
                "all",
                "inbound",
                "outbound",
                "web"
              ],
              "default": "all"
            },
            "description": "Filter by direction."
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Filter by source.",
              "enum": [
                "all",
                "campaign",
                "web",
                "test",
                "other"
              ],
              "default": "all"
            },
            "description": "Filter by source."
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Filter by outcome.",
              "enum": [
                "all",
                "successful",
                "unsuccessful",
                "unknown",
                "failed"
              ],
              "default": "all"
            },
            "description": "Filter by outcome."
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "UTC time range: today starts at UTC midnight; week is the preceding 7 days; month the preceding 30 days.",
              "enum": [
                "all",
                "today",
                "week",
                "month"
              ],
              "default": "month"
            },
            "description": "UTC time range: today starts at UTC midnight; week is the preceding 7 days; month the preceding 30 days."
          },
          {
            "name": "agent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Agent ID, or all. This is agent, not agent_id.",
              "maxLength": 200,
              "default": "all"
            },
            "description": "Agent ID, or all. This is agent, not agent_id."
          },
          {
            "name": "number",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Business number, or all; use + in E.164 and encode it in the query.",
              "maxLength": 80,
              "default": "all"
            },
            "description": "Business number, or all; use + in E.164 and encode it in the query."
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Trimmed literal search in caller name, call ID and phone numbers. Control characters are invalid.",
              "maxLength": 120,
              "default": ""
            },
            "description": "Trimmed literal search in caller name, call ID and phone numbers. Control characters are invalid."
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional ISO timestamp with a time zone. Overrides the period start; must not be after until.",
              "format": "date-time",
              "maxLength": 40
            },
            "description": "Optional ISO timestamp with a time zone. Overrides the period start; must not be after until."
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional ISO timestamp with a time zone; defaults to request time.",
              "format": "date-time",
              "maxLength": 40
            },
            "description": "Optional ISO timestamp with a time zone; defaults to request time."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "call_id": {
                            "type": "string",
                            "description": "Call identifier. Failed starts can use the failed: prefix."
                          },
                          "id": {
                            "type": "string",
                            "description": "Row ID of this call record (UUID) when present. Use `call_id` to identify the call in requests.",
                            "format": "uuid"
                          },
                          "agent_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Agent identifier, if retained."
                          },
                          "from_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Origin number, if retained."
                          },
                          "to_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Destination number, if retained."
                          },
                          "call_type": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Call channel/type, such as inbound, outbound or web."
                          },
                          "call_direction": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Direction recorded for the call."
                          },
                          "call_status": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Recorded lifecycle state; unknown future states must be tolerated."
                          },
                          "duration_ms": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Connected duration in milliseconds; not elapsed ringing time or proof of billed time."
                          },
                          "created_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Creation time when retained.",
                            "format": "date-time"
                          },
                          "start_timestamp": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Start time in Unix milliseconds."
                          },
                          "end_timestamp": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "End time in Unix milliseconds."
                          },
                          "answered_at": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Answer time in Unix milliseconds, when known."
                          },
                          "ended_reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Recorded end/failure reason. A null value is unknown, not success."
                          },
                          "call_successful": {
                            "type": [
                              "boolean",
                              "null"
                            ],
                            "description": "Assessment of success. Null means unknown."
                          },
                          "caller_sentiment": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Post-call sentiment, if retained."
                          },
                          "cost": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Stored cost value. Null must remain unknown."
                          },
                          "charged_minutes": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Stored charged-minute value, when known."
                          },
                          "campaign_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Associated campaign, if any."
                          },
                          "test_requested_by": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Retained test source marker, if any."
                          },
                          "caller_name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Caller name, if retained."
                          },
                          "payload_deleted_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Time content was erased.",
                            "format": "date-time"
                          },
                          "payload_deleted_reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Recorded erasure reason."
                          },
                          "payload_in_own_storage": {
                            "type": [
                              "boolean",
                              "null"
                            ],
                            "description": "Whether payload was stored in account-connected storage; its current contents are not inspected."
                          },
                          "call_retention_days": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Retention policy recorded for this call."
                          },
                          "payload_scheduled_for_deletion": {
                            "type": "boolean",
                            "description": "Content is hidden while deletion processing finishes."
                          },
                          "call_summary": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Retained summary; can be absent or null."
                          },
                          "recording_availability": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Stored recording processing state."
                          },
                          "recording_availability_reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Stored recording processing reason."
                          }
                        },
                        "required": [
                          "call_id"
                        ],
                        "description": "Call metadata and any retained summary. Transcript, event data, extracted data and recording URLs are omitted.",
                        "additionalProperties": true
                      },
                      "description": "Page of matching retained call metadata."
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "description": "All matching retained rows, not just this page.",
                          "minimum": 0
                        },
                        "minutes": {
                          "type": "number",
                          "description": "Sum of nonnegative connected durations divided by 60,000."
                        },
                        "cost": {
                          "type": "number",
                          "description": "Sum of known stored costs; unknown costs are counted separately."
                        },
                        "cost_unknown": {
                          "type": "integer",
                          "description": "Matching rows whose cost is unknown.",
                          "minimum": 0
                        },
                        "successful": {
                          "type": "integer",
                          "description": "Matching rows whose success flag is true.",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "total",
                        "minutes",
                        "cost",
                        "cost_unknown",
                        "successful"
                      ],
                      "description": "",
                      "additionalProperties": false
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "direction": {
                          "type": "string",
                          "description": "Filter by direction.",
                          "enum": [
                            "all",
                            "inbound",
                            "outbound",
                            "web"
                          ],
                          "default": "all"
                        },
                        "source": {
                          "type": "string",
                          "description": "Filter by source.",
                          "enum": [
                            "all",
                            "campaign",
                            "web",
                            "test",
                            "other"
                          ],
                          "default": "all"
                        },
                        "outcome": {
                          "type": "string",
                          "description": "Filter by outcome.",
                          "enum": [
                            "all",
                            "successful",
                            "unsuccessful",
                            "unknown",
                            "failed"
                          ],
                          "default": "all"
                        },
                        "period": {
                          "type": "string",
                          "description": "UTC time range: today starts at UTC midnight; week is the preceding 7 days; month the preceding 30 days.",
                          "enum": [
                            "all",
                            "today",
                            "week",
                            "month"
                          ],
                          "default": "month"
                        },
                        "agent": {
                          "type": "string",
                          "description": "Agent ID, or all. This is agent, not agent_id.",
                          "maxLength": 200,
                          "default": "all"
                        },
                        "number": {
                          "type": "string",
                          "description": "Business number, or all; use + in E.164 and encode it in the query.",
                          "maxLength": 80,
                          "default": "all"
                        },
                        "search": {
                          "type": "string",
                          "description": "Trimmed literal search in caller name, call ID and phone numbers. Control characters are invalid.",
                          "maxLength": 120,
                          "default": ""
                        },
                        "since": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Optional ISO timestamp with a time zone. Overrides the period start; must not be after until.",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "until": {
                          "type": "string",
                          "description": "Optional ISO timestamp with a time zone; defaults to request time.",
                          "format": "date-time",
                          "maxLength": 40
                        }
                      },
                      "required": [
                        "direction",
                        "source",
                        "outcome",
                        "period",
                        "agent",
                        "number",
                        "search",
                        "since",
                        "until"
                      ],
                      "description": "",
                      "additionalProperties": false
                    },
                    "limit": {
                      "type": "integer",
                      "description": "Applied page limit."
                    },
                    "offset": {
                      "type": "integer",
                      "description": "Applied offset; zero during cursor continuation."
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether another page exists."
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Opaque continuation, or null at the end."
                    }
                  },
                  "required": [
                    "data",
                    "totals",
                    "filters",
                    "limit",
                    "offset",
                    "has_more",
                    "next_cursor"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "data": [],
                  "totals": {
                    "total": 0,
                    "minutes": 0,
                    "cost": 0,
                    "cost_unknown": 0,
                    "successful": 0
                  },
                  "filters": {
                    "direction": "all",
                    "source": "all",
                    "outcome": "all",
                    "period": "all",
                    "agent": "all",
                    "number": "all",
                    "search": "",
                    "since": null,
                    "until": "2026-11-01T12:00:00.000Z"
                  },
                  "limit": 1,
                  "offset": 0,
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "invalid_call_history: A filter, timestamp, limit or cursor combination is invalid. Correct the query. Continuation uses cursor and limit only.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "call_data_unavailable: The history snapshot could not be read safely. Retry a bounded read; do not substitute zero totals.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/calls/{id}/recording": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Get a call recording",
        "description": "Read recording status and obtain a fresh signed download link when the managed recording is available. This operation does not read or verify an account-connected storage object. Private recording access uses a 600-second link lifetime; the older path uses 300 seconds. Always follow expires_at. Signing an existing public object does not make its underlying public URL private. An issued link can stop working early if the content is deleted.\n\nStatus meanings: pending means explicit processing; expired means content was removed by retention; customer_bucket identifies account-connected storage without asserting availability; not_recorded is a proven never-started call; pending_deletion hides content while deletion finishes; unavailable is explicit processing failure; unknown means the record cannot prove availability. Missing historical data does not prove recording was switched off.",
        "operationId": "callRecording",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned call ID, including a failed-start ID if applicable.",
              "minLength": 1,
              "maxLength": 200
            },
            "description": "Owned call ID, including a failed-start ID if applicable."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "call_id": {
                      "type": "string",
                      "description": "The requested call ID."
                    },
                    "status": {
                      "type": "string",
                      "description": "available has a signed URL; other states do not.",
                      "enum": [
                        "available",
                        "pending",
                        "expired",
                        "customer_bucket",
                        "not_recorded",
                        "pending_deletion",
                        "unavailable",
                        "unknown"
                      ]
                    },
                    "url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Short-lived download URL only when available. Treat it as a bearer credential and do not log it."
                    },
                    "expires_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Expiry of the returned signed URL, or null.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "call_id",
                    "status",
                    "url",
                    "expires_at"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "call_id": "call_example",
                  "status": "unknown",
                  "url": null,
                  "expires_at": null
                }
              }
            }
          },
          "400": {
            "description": "invalid_call_id: The call ID is invalid or exceeds 200 characters. Use the exact ID returned by a call read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: The call is not available to this account. Check the ID and owning account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "call_data_unavailable: The recording state or signed link could not be verified. Retry the read; do not label this as not recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/agents": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Create an agent",
        "operationId": "createAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Optional create settings. Unknown-only input is refused; extra unknown fields alongside supported fields produce warnings. call_retention_days is inherited on create and must be omitted.",
                "properties": {
                  "is_active": {
                    "type": "boolean",
                    "default": true
                  },
                  "ai_speaks_first": {
                    "type": "boolean",
                    "default": true
                  },
                  "dynamic_greeting": {
                    "type": "boolean",
                    "default": true
                  },
                  "func_end_call": {
                    "type": "boolean",
                    "description": "Voice silence/duration timer gate, not a blanket prohibition on END_CALL.",
                    "default": true
                  },
                  "func_cold_transfer": {
                    "type": "boolean",
                    "description": "Compatibility-only; not the effective transfer permission.",
                    "default": false
                  },
                  "func_send_sms": {
                    "type": "boolean",
                    "description": "Compatibility-only; use incall_sms_enabled for in-call SMS.",
                    "default": false
                  },
                  "record_call": {
                    "type": "boolean",
                    "description": "Agent recording default; an explicit number true/false wins.",
                    "default": true
                  },
                  "post_call_sms_enabled": {
                    "type": "boolean",
                    "default": false
                  },
                  "incall_sms_enabled": {
                    "type": "boolean",
                    "default": false
                  },
                  "amd_enabled": {
                    "type": "boolean",
                    "default": false
                  },
                  "greet_by_name": {
                    "type": "boolean",
                    "description": "Inbound name-greeting hint, independent of remembering callers; not global anonymization.",
                    "default": true
                  },
                  "remember_callers": {
                    "type": "boolean",
                    "description": "Phone caller context/learning; false does not erase saved records or website visitor history.",
                    "default": true
                  },
                  "require_booking_confirmation": {
                    "type": "boolean",
                    "default": false,
                    "description": "Saved confirmation setting for supported calendar changes. A new voice booking always requires one combined read-back and one clear yes, even when false. A null number override inherits the agent."
                  },
                  "voicemail_leave_enabled": {
                    "type": "boolean",
                    "default": false
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 200,
                    "default": "Untitled Agent"
                  },
                  "system_prompt": {
                    "type": "string",
                    "maxLength": 100000,
                    "description": "Up to 3,000 tokens when knowledge prompt checks are enabled; otherwise up to 16,000 characters. The 100,000-character input ceiling is for counting, not the accepted prompt size."
                  },
                  "welcome_message": {
                    "type": "string",
                    "maxLength": 16000,
                    "default": "Hello! How can I help you today?"
                  },
                  "voice_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200,
                    "default": "Ashley"
                  },
                  "voice_key": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 36
                  },
                  "language": {
                    "type": "string",
                    "maxLength": 32,
                    "default": "multi"
                  },
                  "webhook_url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2048,
                    "default": null
                  },
                  "phone_number": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 32,
                    "default": null
                  },
                  "llm_model": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Compatibility-only; does not select the runtime model."
                  },
                  "fallback_message": {
                    "type": "string",
                    "maxLength": 16000,
                    "description": "Compatibility-only; no current runtime consumer.",
                    "default": "I am sorry, could you say that again?"
                  },
                  "post_call_sms_template": {
                    "type": "string",
                    "maxLength": 600,
                    "description": "No endpoint default; supply a template when enabling post-call SMS."
                  },
                  "transfer_number": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 32,
                    "default": null
                  },
                  "transfer_whisper": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 16000,
                    "default": null
                  },
                  "timezone": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Nonempty IANA time zone. When omitted, use the valid account time zone or UTC."
                  },
                  "boosted_keywords": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000,
                    "default": null,
                    "description": "Customer keyterms: at most 20 nonempty comma-separated terms, at most 50 Unicode characters per trimmed term, and a conservative 450-byte total safety budget for changed values. The text field also has a 2,000-character ceiling. Empty entries do not count; repeated nonempty terms count separately toward 20. Null clears the list.",
                    "x-max-nonempty-comma-terms": 20,
                    "example": "Nixflex, Sam, appointment",
                    "x-max-trimmed-term-codepoints": 50,
                    "x-max-conservative-keyterm-bytes": 450
                  },
                  "voicemail_message": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 600,
                    "description": "Required and nonblank when voicemail_leave_enabled is true; no endpoint default."
                  },
                  "temperature": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 0.7,
                    "default": 0.3
                  },
                  "response_eagerness": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "default": 200
                  },
                  "stt_confidence": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "default": 0
                  },
                  "stt_max_silence_ms": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2147483647,
                    "default": 0
                  },
                  "interruption_sensitivity": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100,
                    "description": "Stored compatibility value; does not tune current interruption decisions.",
                    "default": 50
                  },
                  "max_call_duration_seconds": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 2147483,
                    "default": 300,
                    "description": "Null uses the runtime fallback; it does not mean unlimited."
                  },
                  "silence_hangup_seconds": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 2147483,
                    "default": 10,
                    "description": "Null uses the runtime fallback."
                  },
                  "wait_tag_seconds": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 30,
                    "maximum": 120,
                    "default": null
                  },
                  "ivr_timeout_seconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1800,
                    "default": 240
                  },
                  "voice_speed": {
                    "type": "number",
                    "minimum": 0.01,
                    "maximum": 100,
                    "description": "Compatibility-only; use speaking_rate.",
                    "default": 0.85
                  },
                  "speaking_rate": {
                    "oneOf": [
                      {
                        "type": [
                          "number",
                          "null"
                        ]
                      },
                      {
                        "type": "string",
                        "enum": [
                          ""
                        ]
                      }
                    ],
                    "description": "Existing numeric clamp to 0.5..1.5. Null or empty clears.",
                    "default": null
                  },
                  "pickup_delay": {
                    "description": "Legacy input handling and default (10) unchanged in this release.",
                    "default": 10
                  },
                  "dtmf_enabled": {
                    "type": [
                      "boolean",
                      "null"
                    ],
                    "default": null
                  },
                  "response_length": {
                    "type": "string",
                    "enum": [
                      "short",
                      "medium",
                      "long"
                    ],
                    "default": "short"
                  },
                  "transfer_type": {
                    "type": "string",
                    "enum": [
                      "cold",
                      "warm"
                    ],
                    "default": "cold"
                  },
                  "recording_source": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "provider or nixflex (case/space normalized); null/empty clears to provider.",
                    "default": "provider"
                  },
                  "data_extraction_fields": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "name",
                        "type"
                      ],
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$",
                          "description": "Unique; __proto__, constructor and prototype forbidden."
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "text",
                            "selector",
                            "boolean",
                            "number"
                          ]
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "optional": {
                          "type": "boolean"
                        },
                        "format_example": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "choices": {
                          "type": "array",
                          "maxItems": 100,
                          "uniqueItems": true,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "description": "Required non-empty for selector; whitespace-only choices rejected."
                        }
                      }
                    },
                    "default": []
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "name": "Reception",
                "system_prompt": "Answer business enquiries clearly.",
                "boosted_keywords": "Nixflex, Sam, appointment"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created agent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One safe projection for create, update, get and list. No secrets or automatic future-column exposure.",
                  "properties": {
                    "is_active": {
                      "type": "boolean"
                    },
                    "ai_speaks_first": {
                      "type": "boolean"
                    },
                    "dynamic_greeting": {
                      "type": "boolean"
                    },
                    "func_end_call": {
                      "type": "boolean"
                    },
                    "func_cold_transfer": {
                      "type": "boolean"
                    },
                    "func_send_sms": {
                      "type": "boolean"
                    },
                    "record_call": {
                      "type": "boolean"
                    },
                    "post_call_sms_enabled": {
                      "type": "boolean"
                    },
                    "incall_sms_enabled": {
                      "type": "boolean"
                    },
                    "amd_enabled": {
                      "type": "boolean"
                    },
                    "greet_by_name": {
                      "type": "boolean"
                    },
                    "remember_callers": {
                      "type": "boolean"
                    },
                    "require_booking_confirmation": {
                      "type": "boolean",
                      "description": "Saved confirmation setting for supported calendar changes. A new voice booking always requires one combined read-back and one clear yes, even when false. A null number override inherits the agent."
                    },
                    "voicemail_leave_enabled": {
                      "type": "boolean"
                    },
                    "name": {
                      "type": "string"
                    },
                    "system_prompt": {
                      "type": "string"
                    },
                    "welcome_message": {
                      "type": "string"
                    },
                    "voice_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "voice_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "language": {
                      "type": "string"
                    },
                    "webhook_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "phone_number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "llm_model": {
                      "type": "string"
                    },
                    "fallback_message": {
                      "type": "string"
                    },
                    "post_call_sms_template": {
                      "type": "string"
                    },
                    "transfer_number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "transfer_whisper": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "boosted_keywords": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Customer keyterms: at most 20 nonempty comma-separated terms, at most 50 Unicode characters per trimmed term, and a conservative 450-byte total safety budget for changed values. The text field also has a 2,000-character ceiling. Empty entries do not count; repeated nonempty terms count separately toward 20. Null clears the list.",
                      "x-max-nonempty-comma-terms": 20,
                      "x-max-trimmed-term-codepoints": 50,
                      "x-max-conservative-keyterm-bytes": 450
                    },
                    "voicemail_message": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "temperature": {
                      "type": "number"
                    },
                    "response_eagerness": {
                      "type": "integer"
                    },
                    "stt_confidence": {
                      "type": "number"
                    },
                    "stt_max_silence_ms": {
                      "type": "integer"
                    },
                    "interruption_sensitivity": {
                      "type": "integer"
                    },
                    "max_call_duration_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "silence_hangup_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "wait_tag_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "ivr_timeout_seconds": {
                      "type": "integer"
                    },
                    "voice_speed": {
                      "type": "number"
                    },
                    "dtmf_enabled": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "response_length": {
                      "type": "string",
                      "enum": [
                        "short",
                        "medium",
                        "long"
                      ]
                    },
                    "transfer_type": {
                      "type": "string",
                      "enum": [
                        "cold",
                        "warm"
                      ]
                    },
                    "recording_source": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "provider",
                        "nixflex",
                        null
                      ]
                    },
                    "data_extraction_fields": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "name",
                          "type"
                        ],
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$",
                            "description": "Unique; __proto__, constructor and prototype forbidden."
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "text",
                              "selector",
                              "boolean",
                              "number"
                            ]
                          },
                          "description": {
                            "type": "string",
                            "maxLength": 2000
                          },
                          "optional": {
                            "type": "boolean"
                          },
                          "format_example": {
                            "type": "string",
                            "maxLength": 2000
                          },
                          "choices": {
                            "type": "array",
                            "maxItems": 100,
                            "uniqueItems": true,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "description": "Required non-empty for selector; whitespace-only choices rejected."
                          }
                        }
                      }
                    },
                    "pickup_delay": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "speaking_rate": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "readOnly": true
                    },
                    "agent_id": {
                      "type": "string",
                      "readOnly": true
                    },
                    "api_key_id": {
                      "type": "string",
                      "readOnly": true
                    },
                    "created_at": {
                      "type": "string",
                      "readOnly": true
                    },
                    "updated_at": {
                      "type": "string",
                      "readOnly": true
                    },
                    "greeting_language": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "precall_webhook_url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "tester_scenarios": {
                      "description": "Stored compatibility metadata; not a create input."
                    },
                    "outbound_transfer_numbers": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      },
                      "readOnly": true
                    },
                    "outbound_warm_transfer_numbers": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      },
                      "readOnly": true
                    },
                    "outbound_post_call_sms_templates": {
                      "description": "Stored compatibility message template data; not a create input."
                    },
                    "outbound_max_duration_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "outbound_silence_hangup_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "call_retention_days": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "enum": [
                        90,
                        30,
                        7,
                        1,
                        0,
                        null
                      ]
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "unknown_fields"
                            ]
                          },
                          "fields": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "message": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Check the named field and its documented type or limit. keyterms_term_too_long: Keep each word or phrase within 50 characters to save keyterms_list_too_large: This list is {over_bytes} bytes over the 450-byte safety limit. Shorten or remove some words to save.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "term_count": {
                    "value": {
                      "error": {
                        "code": "invalid_agent_field",
                        "message": "Keep up to 20 words - remove some to save",
                        "details": {
                          "field": "boosted_keywords"
                        },
                        "doc_url": "https://docs.nixflex.com/errors/invalid_agent_field",
                        "type": "invalid_request"
                      }
                    }
                  },
                  "term_length": {
                    "value": {
                      "error": {
                        "type": "invalid_request",
                        "code": "keyterms_term_too_long",
                        "message": "Keep each word or phrase within 50 characters to save",
                        "details": {
                          "field": "boosted_keywords",
                          "limit": 50
                        },
                        "doc_url": "https://docs.nixflex.com/errors/keyterms_term_too_long"
                      }
                    }
                  },
                  "list_bytes": {
                    "value": {
                      "error": {
                        "type": "invalid_request",
                        "code": "keyterms_list_too_large",
                        "message": "This list is 3 bytes over the 450-byte safety limit. Shorten or remove some words to save.",
                        "details": {
                          "field": "boosted_keywords",
                          "limit": 450,
                          "actual_bytes": 453,
                          "over_bytes": 3
                        },
                        "doc_url": "https://docs.nixflex.com/errors/keyterms_list_too_large"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "type": "authentication_error",
                    "code": "unauthorized",
                    "message": "Invalid or missing API key",
                    "doc_url": "https://docs.nixflex.com/errors/unauthorized",
                    "details": {}
                  }
                }
              }
            }
          },
          "403": {
            "description": "The organisation policy refused this operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "type": "permission_denied",
                    "code": "permission_denied",
                    "message": "The organisation policy refused this operation.",
                    "doc_url": "https://docs.nixflex.com/errors/permission_denied",
                    "details": {}
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Read Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "type": "rate_limit",
                    "code": "rate_limit_exceeded",
                    "message": "Rate limit exceeded. Read Retry-After.",
                    "doc_url": "https://docs.nixflex.com/errors/rate_limit_exceeded",
                    "details": {}
                  }
                }
              }
            }
          },
          "500": {
            "description": "The outcome could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "type": "server_error",
                    "code": "server_error",
                    "message": "The outcome could not be confirmed.",
                    "doc_url": "https://docs.nixflex.com/errors/server_error",
                    "details": {}
                  }
                }
              }
            }
          },
          "503": {
            "description": "Agent storage is unavailable; read state before another write.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "type": "server_error",
                    "code": "agent_store_unavailable",
                    "message": "Agent storage is unavailable; read state before another write.",
                    "doc_url": "https://docs.nixflex.com/errors/agent_store_unavailable",
                    "details": {}
                  }
                }
              }
            }
          }
        },
        "description": "Create an agent with optional settings. An empty JSON object is valid. Omitted settings use normal creation defaults; this operation has no general idempotency guarantee."
      },
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "List agents",
        "operationId": "listAgents",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Owned agents; active by default. Optional status/search. Stable created_at DESC, agent_id DESC ordering. Bare array. Strict bounds: invalid queries return 400 invalid_agent_list.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Strict decimal integer; no signs, fractions, leading zeros or repeated values. Invalid values return 400 invalid_agent_list; not clamped.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Strict decimal integer. Pages are not a snapshot during concurrent writes.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "disabled",
                "all"
              ],
              "default": "active"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Case-insensitive literal name/agent_id substring. Trim outer whitespace; empty means no search. Control characters forbidden. No wildcard or regex syntax.",
            "schema": {
              "type": "string",
              "maxLength": 200,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "description": "One safe projection for create, update, get and list. No secrets or automatic future-column exposure.",
                    "properties": {
                      "is_active": {
                        "type": "boolean"
                      },
                      "ai_speaks_first": {
                        "type": "boolean"
                      },
                      "dynamic_greeting": {
                        "type": "boolean"
                      },
                      "func_end_call": {
                        "type": "boolean"
                      },
                      "func_cold_transfer": {
                        "type": "boolean"
                      },
                      "func_send_sms": {
                        "type": "boolean"
                      },
                      "record_call": {
                        "type": "boolean"
                      },
                      "post_call_sms_enabled": {
                        "type": "boolean"
                      },
                      "incall_sms_enabled": {
                        "type": "boolean"
                      },
                      "amd_enabled": {
                        "type": "boolean"
                      },
                      "greet_by_name": {
                        "type": "boolean"
                      },
                      "remember_callers": {
                        "type": "boolean"
                      },
                      "require_booking_confirmation": {
                        "type": "boolean",
                        "description": "Saved confirmation setting for supported calendar changes. A new voice booking always requires one combined read-back and one clear yes, even when false. A null number override inherits the agent."
                      },
                      "voicemail_leave_enabled": {
                        "type": "boolean"
                      },
                      "name": {
                        "type": "string"
                      },
                      "system_prompt": {
                        "type": "string"
                      },
                      "welcome_message": {
                        "type": "string"
                      },
                      "voice_id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "voice_key": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "language": {
                        "type": "string"
                      },
                      "webhook_url": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "phone_number": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "llm_model": {
                        "type": "string"
                      },
                      "fallback_message": {
                        "type": "string"
                      },
                      "post_call_sms_template": {
                        "type": "string"
                      },
                      "transfer_number": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "transfer_whisper": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "timezone": {
                        "type": "string"
                      },
                      "boosted_keywords": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "voicemail_message": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "temperature": {
                        "type": "number"
                      },
                      "response_eagerness": {
                        "type": "integer"
                      },
                      "stt_confidence": {
                        "type": "number"
                      },
                      "stt_max_silence_ms": {
                        "type": "integer"
                      },
                      "interruption_sensitivity": {
                        "type": "integer"
                      },
                      "max_call_duration_seconds": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "silence_hangup_seconds": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "wait_tag_seconds": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "ivr_timeout_seconds": {
                        "type": "integer"
                      },
                      "voice_speed": {
                        "type": "number"
                      },
                      "dtmf_enabled": {
                        "type": [
                          "boolean",
                          "null"
                        ]
                      },
                      "response_length": {
                        "type": "string",
                        "enum": [
                          "short",
                          "medium",
                          "long"
                        ]
                      },
                      "transfer_type": {
                        "type": "string",
                        "enum": [
                          "cold",
                          "warm"
                        ]
                      },
                      "recording_source": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "enum": [
                          "provider",
                          "nixflex",
                          null
                        ]
                      },
                      "data_extraction_fields": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "name",
                            "type"
                          ],
                          "properties": {
                            "name": {
                              "type": "string",
                              "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$",
                              "description": "Unique; __proto__, constructor and prototype forbidden."
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "text",
                                "selector",
                                "boolean",
                                "number"
                              ]
                            },
                            "description": {
                              "type": "string",
                              "maxLength": 2000
                            },
                            "optional": {
                              "type": "boolean"
                            },
                            "format_example": {
                              "type": "string",
                              "maxLength": 2000
                            },
                            "choices": {
                              "type": "array",
                              "maxItems": 100,
                              "uniqueItems": true,
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "description": "Required non-empty for selector; whitespace-only choices rejected."
                            }
                          }
                        }
                      },
                      "pickup_delay": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "speaking_rate": {
                        "type": [
                          "number",
                          "null"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "readOnly": true
                      },
                      "agent_id": {
                        "type": "string",
                        "readOnly": true
                      },
                      "api_key_id": {
                        "type": "string",
                        "readOnly": true
                      },
                      "created_at": {
                        "type": "string",
                        "readOnly": true
                      },
                      "updated_at": {
                        "type": "string",
                        "readOnly": true
                      },
                      "greeting_language": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "readOnly": true
                      },
                      "precall_webhook_url": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "readOnly": true
                      },
                      "tester_scenarios": {
                        "type": "array",
                        "items": {},
                        "readOnly": true
                      },
                      "outbound_transfer_numbers": {
                        "type": "array",
                        "items": {},
                        "readOnly": true
                      },
                      "outbound_warm_transfer_numbers": {
                        "type": "array",
                        "items": {},
                        "readOnly": true
                      },
                      "outbound_post_call_sms_templates": {
                        "type": "array",
                        "items": {},
                        "readOnly": true
                      },
                      "outbound_max_duration_seconds": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "readOnly": true
                      },
                      "outbound_silence_hangup_seconds": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "readOnly": true
                      },
                      "call_retention_days": {
                        "type": "integer",
                        "enum": [
                          90,
                          30,
                          7,
                          1,
                          0
                        ]
                      },
                      "warnings": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "enum": [
                                "unknown_fields"
                              ]
                            },
                            "fields": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "message": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid agent list query.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "type": "invalid_request",
                    "code": "invalid_agent_list",
                    "message": "Invalid agent list query.",
                    "doc_url": "https://docs.nixflex.com/errors/invalid_agent_list",
                    "details": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "type": "authentication_error",
                    "code": "unauthorized",
                    "message": "Invalid or missing API key",
                    "doc_url": "https://docs.nixflex.com/errors/unauthorized",
                    "details": {}
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Agent storage or catalog unavailable; check before retrying a write.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/agents/{id}": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Get an agent",
        "operationId": "getAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One safe projection for create, update, get and list. No secrets or automatic future-column exposure.",
                  "properties": {
                    "is_active": {
                      "type": "boolean"
                    },
                    "ai_speaks_first": {
                      "type": "boolean"
                    },
                    "dynamic_greeting": {
                      "type": "boolean"
                    },
                    "func_end_call": {
                      "type": "boolean"
                    },
                    "func_cold_transfer": {
                      "type": "boolean"
                    },
                    "func_send_sms": {
                      "type": "boolean"
                    },
                    "record_call": {
                      "type": "boolean"
                    },
                    "post_call_sms_enabled": {
                      "type": "boolean"
                    },
                    "incall_sms_enabled": {
                      "type": "boolean"
                    },
                    "amd_enabled": {
                      "type": "boolean"
                    },
                    "greet_by_name": {
                      "type": "boolean"
                    },
                    "remember_callers": {
                      "type": "boolean"
                    },
                    "require_booking_confirmation": {
                      "type": "boolean",
                      "description": "Saved confirmation setting for supported calendar changes. A new voice booking always requires one combined read-back and one clear yes, even when false. A null number override inherits the agent."
                    },
                    "voicemail_leave_enabled": {
                      "type": "boolean"
                    },
                    "name": {
                      "type": "string"
                    },
                    "system_prompt": {
                      "type": "string"
                    },
                    "welcome_message": {
                      "type": "string"
                    },
                    "voice_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "voice_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "language": {
                      "type": "string"
                    },
                    "webhook_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "phone_number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "llm_model": {
                      "type": "string"
                    },
                    "fallback_message": {
                      "type": "string"
                    },
                    "post_call_sms_template": {
                      "type": "string"
                    },
                    "transfer_number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "transfer_whisper": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "boosted_keywords": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "voicemail_message": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "temperature": {
                      "type": "number"
                    },
                    "response_eagerness": {
                      "type": "integer"
                    },
                    "stt_confidence": {
                      "type": "number"
                    },
                    "stt_max_silence_ms": {
                      "type": "integer"
                    },
                    "interruption_sensitivity": {
                      "type": "integer"
                    },
                    "max_call_duration_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "silence_hangup_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "wait_tag_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "ivr_timeout_seconds": {
                      "type": "integer"
                    },
                    "voice_speed": {
                      "type": "number"
                    },
                    "dtmf_enabled": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "response_length": {
                      "type": "string",
                      "enum": [
                        "short",
                        "medium",
                        "long"
                      ]
                    },
                    "transfer_type": {
                      "type": "string",
                      "enum": [
                        "cold",
                        "warm"
                      ]
                    },
                    "recording_source": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "provider",
                        "nixflex",
                        null
                      ]
                    },
                    "data_extraction_fields": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "name",
                          "type"
                        ],
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$",
                            "description": "Unique; __proto__, constructor and prototype forbidden."
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "text",
                              "selector",
                              "boolean",
                              "number"
                            ]
                          },
                          "description": {
                            "type": "string",
                            "maxLength": 2000
                          },
                          "optional": {
                            "type": "boolean"
                          },
                          "format_example": {
                            "type": "string",
                            "maxLength": 2000
                          },
                          "choices": {
                            "type": "array",
                            "maxItems": 100,
                            "uniqueItems": true,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "description": "Required non-empty for selector; whitespace-only choices rejected."
                          }
                        }
                      }
                    },
                    "pickup_delay": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "speaking_rate": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "readOnly": true
                    },
                    "agent_id": {
                      "type": "string",
                      "readOnly": true
                    },
                    "api_key_id": {
                      "type": "string",
                      "readOnly": true
                    },
                    "created_at": {
                      "type": "string",
                      "readOnly": true
                    },
                    "updated_at": {
                      "type": "string",
                      "readOnly": true
                    },
                    "greeting_language": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "precall_webhook_url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "tester_scenarios": {
                      "type": "array",
                      "items": {},
                      "readOnly": true
                    },
                    "outbound_transfer_numbers": {
                      "type": "array",
                      "items": {},
                      "readOnly": true
                    },
                    "outbound_warm_transfer_numbers": {
                      "type": "array",
                      "items": {},
                      "readOnly": true
                    },
                    "outbound_post_call_sms_templates": {
                      "type": "array",
                      "items": {},
                      "readOnly": true
                    },
                    "outbound_max_duration_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "outbound_silence_hangup_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "call_retention_days": {
                      "type": "integer",
                      "enum": [
                        90,
                        30,
                        7,
                        1,
                        0
                      ]
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "unknown_fields"
                            ]
                          },
                          "fields": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "message": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "knowledge_keyterms": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "maxItems": 100,
                      "description": "Optional when knowledge is enabled. Ranked live automatic terms, filtered against saved customer terms; default cap 80, platform-configurable. Read-only."
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Agent storage or catalog unavailable; check before retrying a write.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "put": {
        "tags": [
          "Agents"
        ],
        "summary": "Update an agent",
        "description": "Change selected settings on an account-owned agent. Although the method is PUT, this is a partial update: omitted fields keep their saved values. Creation defaults are not reapplied. Send JSON booleans and numbers, not strings. A null value is allowed only where stated. Changing voice_key, voice_id or language revalidates the resulting voice selection; use one identifier or a matching pair. A language-only update rechecks the existing voice. Enabling voicemail is checked against the merged saved/request state. Unknown fields are ignored only alongside a supported field and appear in warnings.\n\nThe system_prompt limit is 3,000 tokens with knowledge enabled, otherwise 16,000 characters. A 100,000-character parsing ceiling is not the accepted prompt size. Extraction definitions reject unknown nested fields and reserve __proto__, constructor and prototype. Compatibility fields remain stored settings and do not necessarily select runtime behaviour.\n\nCustomer keyterms: at most 20 nonempty comma-separated terms, at most 50 Unicode characters per trimmed term, and a conservative 450-byte total safety budget for changed values. The text field also has a 2,000-character ceiling. Empty entries do not count; repeated nonempty terms count separately toward 20. Null clears the list. On update, omitted values are retained. An exact unchanged saved string is kept even if it exceeds the newer count, term-length, size or text limits. Any change must meet all current limits.\n\nThe safety byte count normalizes each trimmed term (NFKD, removes combining marks, lowercases, removes whitespace) to detect duplicates. Each unique normalized term costs the UTF-8 bytes of its first trimmed original spelling plus 4 bytes. Empty and duplicate normalized terms add no bytes. This conservative count is not a tokenizer. Term length counts Unicode code points, not UTF-16 code units.\n\nAutomatic knowledge terms are read-only. They come from valid, unsuppressed live pieces, keep source spelling, and are ranked by importance, essential identity, repeated support and stable tie-breaks. Generic terms are filtered. The default limit is 80 per agent; platform configuration can choose 0–100. Customer terms take priority and stay first on calls; duplicates and weaker automatic terms are removed to fit the call limits. The returned list is not a promise that every term will be sent on a call. Read [automatic keyterms](/api-reference/knowledge/get-agents-target-knowledge-keyterms).\n\nMore than 20 changed terms returns 400 invalid_agent_field with message \"Keep up to 20 words - remove some to save\" and details.field \"boosted_keywords\". The count check runs before term-length and safety-byte checks. DELETE switches is_active to false; it does not remove the record. GET by owned agent ID still returns the inactive agent. The default active-only list omits it; status=disabled or status=all includes it.",
        "operationId": "updateAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The account-owned identifier returned by the API."
            },
            "description": "The account-owned identifier returned by the API."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One safe projection for create, update, get and list. No secrets or automatic future-column exposure.",
                  "properties": {
                    "is_active": {
                      "type": "boolean"
                    },
                    "ai_speaks_first": {
                      "type": "boolean"
                    },
                    "dynamic_greeting": {
                      "type": "boolean"
                    },
                    "func_end_call": {
                      "type": "boolean"
                    },
                    "func_cold_transfer": {
                      "type": "boolean"
                    },
                    "func_send_sms": {
                      "type": "boolean"
                    },
                    "record_call": {
                      "type": "boolean"
                    },
                    "post_call_sms_enabled": {
                      "type": "boolean"
                    },
                    "incall_sms_enabled": {
                      "type": "boolean"
                    },
                    "amd_enabled": {
                      "type": "boolean"
                    },
                    "greet_by_name": {
                      "type": "boolean"
                    },
                    "remember_callers": {
                      "type": "boolean"
                    },
                    "require_booking_confirmation": {
                      "type": "boolean",
                      "description": "Saved confirmation setting for supported calendar changes. A new voice booking always requires one combined read-back and one clear yes, even when false. A null number override inherits the agent."
                    },
                    "voicemail_leave_enabled": {
                      "type": "boolean"
                    },
                    "name": {
                      "type": "string"
                    },
                    "system_prompt": {
                      "type": "string"
                    },
                    "welcome_message": {
                      "type": "string"
                    },
                    "voice_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "voice_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "language": {
                      "type": "string"
                    },
                    "webhook_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "phone_number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "llm_model": {
                      "type": "string"
                    },
                    "fallback_message": {
                      "type": "string"
                    },
                    "post_call_sms_template": {
                      "type": "string"
                    },
                    "transfer_number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "transfer_whisper": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "boosted_keywords": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Customer keyterms: at most 20 nonempty comma-separated terms, at most 50 Unicode characters per trimmed term, and a conservative 450-byte total safety budget for changed values. The text field also has a 2,000-character ceiling. Empty entries do not count; repeated nonempty terms count separately toward 20. Null clears the list. On update, omitted values are retained. An exact unchanged saved string is kept even if it exceeds the newer count, term-length, size or text limits. Any change must meet all current limits.",
                      "x-max-nonempty-comma-terms": 20,
                      "x-max-trimmed-term-codepoints": 50,
                      "x-max-conservative-keyterm-bytes": 450,
                      "x-docs-summary": "Changed values: 20 terms, 50 characters each, 450-byte safety budget. See keyterms rules below."
                    },
                    "voicemail_message": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "temperature": {
                      "type": "number"
                    },
                    "response_eagerness": {
                      "type": "integer"
                    },
                    "stt_confidence": {
                      "type": "number"
                    },
                    "stt_max_silence_ms": {
                      "type": "integer"
                    },
                    "interruption_sensitivity": {
                      "type": "integer"
                    },
                    "max_call_duration_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "silence_hangup_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "wait_tag_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "ivr_timeout_seconds": {
                      "type": "integer"
                    },
                    "voice_speed": {
                      "type": "number"
                    },
                    "dtmf_enabled": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "response_length": {
                      "type": "string",
                      "enum": [
                        "short",
                        "medium",
                        "long"
                      ]
                    },
                    "transfer_type": {
                      "type": "string",
                      "enum": [
                        "cold",
                        "warm"
                      ]
                    },
                    "recording_source": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "provider",
                        "nixflex",
                        null
                      ]
                    },
                    "data_extraction_fields": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "name",
                          "type"
                        ],
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$",
                            "description": "Unique; __proto__, constructor and prototype forbidden."
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "text",
                              "selector",
                              "boolean",
                              "number"
                            ]
                          },
                          "description": {
                            "type": "string",
                            "maxLength": 2000
                          },
                          "optional": {
                            "type": "boolean"
                          },
                          "format_example": {
                            "type": "string",
                            "maxLength": 2000
                          },
                          "choices": {
                            "type": "array",
                            "maxItems": 100,
                            "uniqueItems": true,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "description": "Required non-empty for selector; whitespace-only choices rejected."
                          }
                        }
                      }
                    },
                    "pickup_delay": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "speaking_rate": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "readOnly": true
                    },
                    "agent_id": {
                      "type": "string",
                      "readOnly": true
                    },
                    "api_key_id": {
                      "type": "string",
                      "readOnly": true
                    },
                    "created_at": {
                      "type": "string",
                      "readOnly": true
                    },
                    "updated_at": {
                      "type": "string",
                      "readOnly": true
                    },
                    "greeting_language": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "precall_webhook_url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "tester_scenarios": {
                      "description": "Stored compatibility metadata; not a create input."
                    },
                    "outbound_transfer_numbers": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      },
                      "readOnly": true
                    },
                    "outbound_warm_transfer_numbers": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      },
                      "readOnly": true
                    },
                    "outbound_post_call_sms_templates": {
                      "description": "Stored compatibility message template data; not a create input."
                    },
                    "outbound_max_duration_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "outbound_silence_hangup_seconds": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "readOnly": true
                    },
                    "call_retention_days": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "enum": [
                        90,
                        30,
                        7,
                        1,
                        0,
                        null
                      ]
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "unknown_fields"
                            ]
                          },
                          "fields": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "message": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": false
                },
                "example": {
                  "agent_id": "agent_0123456789abcdef",
                  "name": "Updated example agent",
                  "temperature": 0.2,
                  "max_call_duration_seconds": 300,
                  "silence_hangup_seconds": 10,
                  "dynamic_greeting": true,
                  "is_active": true,
                  "boosted_keywords": "Nixflex, Sam, appointment"
                }
              }
            }
          },
          "400": {
            "description": "empty_agent_update: No supported field was supplied. Send at least one documented field. invalid_agent_field: A field has the wrong type or exceeds its limit. Read error.details.field and correct that value. invalid_call_retention_days: Retention is not one of the supported day values. Use 90, 30, 7, 1 or 0. prompt_too_long: The prompt exceeds the applicable limit. Shorten the prompt; a character estimate is not a token count. voicemail_message_required: Voicemail would be enabled without a message. Supply a nonblank message or disable voicemail in the same request. invalid_recording_source: The recording source is not supported. Use provider, nixflex, null or an empty string. deprecated_field: An old agent credential field was supplied. Remove credentials from the agent request. invalid_voice_key: The selected catalog voice cannot serve this update. Choose an available voice compatible with the language; use matching voice identifiers. voice_not_found: The selected catalog voice cannot serve this update. Choose an available voice compatible with the language; use matching voice identifiers. voice_selection_conflict: The selected catalog voice cannot serve this update. Choose an available voice compatible with the language; use matching voice identifiers. voice_unavailable: The selected catalog voice cannot serve this update. Choose an available voice compatible with the language; use matching voice identifiers. voice_temporarily_unavailable: The selected catalog voice cannot serve this update. Choose an available voice compatible with the language; use matching voice identifiers. voice_not_available: The selected catalog voice cannot serve this update. Choose an available voice compatible with the language; use matching voice identifiers. voice_incompatible_language: The selected catalog voice cannot serve this update. Choose an available voice compatible with the language; use matching voice identifiers. no_approved_languages: The selected catalog voice cannot serve this update. Choose an available voice compatible with the language; use matching voice identifiers. keyterms_term_too_long: Keep each word or phrase within 50 characters to save keyterms_list_too_large: This list is {over_bytes} bytes over the 450-byte safety limit. Shorten or remove some words to save.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "examples": {
                  "term_count": {
                    "value": {
                      "error": {
                        "code": "invalid_agent_field",
                        "message": "Keep up to 20 words - remove some to save",
                        "details": {
                          "field": "boosted_keywords"
                        },
                        "doc_url": "https://docs.nixflex.com/errors/invalid_agent_field",
                        "type": "invalid_request"
                      }
                    }
                  },
                  "term_length": {
                    "value": {
                      "error": {
                        "type": "invalid_request",
                        "code": "keyterms_term_too_long",
                        "message": "Keep each word or phrase within 50 characters to save",
                        "details": {
                          "field": "boosted_keywords",
                          "limit": 50
                        },
                        "doc_url": "https://docs.nixflex.com/errors/keyterms_term_too_long"
                      }
                    }
                  },
                  "list_bytes": {
                    "value": {
                      "error": {
                        "type": "invalid_request",
                        "code": "keyterms_list_too_large",
                        "message": "This list is 3 bytes over the 450-byte safety limit. Shorten or remove some words to save.",
                        "details": {
                          "field": "boosted_keywords",
                          "limit": 450,
                          "actual_bytes": 453,
                          "over_bytes": 3
                        },
                        "doc_url": "https://docs.nixflex.com/errors/keyterms_list_too_large"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: The agent does not belong to this account or does not exist. Use an agent ID returned by this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "agent_store_unavailable: The saved result could not be confirmed. Read the agent and reconcile its settings before another write. catalog_unavailable: Voice validation is unavailable. Wait for the catalog before deliberately submitting a new request. prompt_check_unavailable: The prompt check did not finish. Wait for recovery; inspect the saved agent before another attempt.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Partial update. Omitted fields remain unchanged; create defaults are never reapplied. At least one recognised field is required. Unknown fields alongside recognised fields produce warnings; unknown-only input is refused.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Partial update. Omitted fields remain unchanged; create defaults are never reapplied. At least one recognised field is required. Unknown fields alongside recognised fields produce warnings; unknown-only input is refused.",
                "properties": {
                  "is_active": {
                    "type": "boolean",
                    "description": "Whether the agent is active."
                  },
                  "ai_speaks_first": {
                    "type": "boolean",
                    "description": "Let the agent speak first."
                  },
                  "dynamic_greeting": {
                    "type": "boolean",
                    "description": "Generate a greeting for the conversation."
                  },
                  "func_end_call": {
                    "type": "boolean",
                    "description": "Voice silence/duration timer gate, not a blanket prohibition on END_CALL."
                  },
                  "func_cold_transfer": {
                    "type": "boolean",
                    "description": "Compatibility-only; not the effective transfer permission."
                  },
                  "func_send_sms": {
                    "type": "boolean",
                    "description": "Compatibility-only; use incall_sms_enabled for in-call SMS."
                  },
                  "record_call": {
                    "type": "boolean",
                    "description": "Agent recording default; an explicit number true/false wins."
                  },
                  "post_call_sms_enabled": {
                    "type": "boolean",
                    "description": "Enable a post-call SMS where supported."
                  },
                  "incall_sms_enabled": {
                    "type": "boolean",
                    "description": "Allow in-call SMS under the effective number policy."
                  },
                  "amd_enabled": {
                    "type": "boolean",
                    "description": "Enable answering-machine detection where supported."
                  },
                  "greet_by_name": {
                    "type": "boolean",
                    "description": "Inbound name-greeting hint, independent of remembering callers; not global anonymization."
                  },
                  "remember_callers": {
                    "type": "boolean",
                    "description": "Phone caller context/learning; false does not erase saved records or website visitor history."
                  },
                  "require_booking_confirmation": {
                    "type": "boolean",
                    "description": "Saved confirmation setting for supported calendar changes. A new voice booking always requires one combined read-back and one clear yes, even when false. A null number override inherits the agent."
                  },
                  "voicemail_leave_enabled": {
                    "type": "boolean",
                    "description": "Requires a nonblank `voicemail_message` when true."
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Up to 200 characters."
                  },
                  "system_prompt": {
                    "type": "string",
                    "maxLength": 100000,
                    "description": "Up to 3,000 tokens when knowledge prompt checks are enabled; otherwise up to 16,000 characters. The 100,000-character input ceiling is for counting, not the accepted prompt size."
                  },
                  "welcome_message": {
                    "type": "string",
                    "maxLength": 16000,
                    "description": "Up to 16,000 characters. Static greeting when dynamic greeting is off."
                  },
                  "voice_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200,
                    "description": "Older catalogue alias, up to 200 characters; prefer `voice_key`. If both voice fields are supplied, they must identify the same voice."
                  },
                  "voice_key": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 36,
                    "description": "Catalog identifier, up to 36 characters. Prefer this to a voice alias."
                  },
                  "language": {
                    "type": "string",
                    "maxLength": 32,
                    "description": "Supported language code or `multi`, up to 32 characters; empty uses `multi`. The selected voice must support the language."
                  },
                  "webhook_url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2048,
                    "description": "HTTP(S) URL without embedded credentials, up to 2,048 characters; empty is accepted."
                  },
                  "phone_number": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 32,
                    "description": "E.164, null or empty, up to 32 characters. Does not import or attach a number."
                  },
                  "llm_model": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Compatibility-only; does not select the runtime model."
                  },
                  "fallback_message": {
                    "type": "string",
                    "maxLength": 16000,
                    "description": "Compatibility-only; no current runtime consumer."
                  },
                  "post_call_sms_template": {
                    "type": "string",
                    "maxLength": 600,
                    "description": "No endpoint default; supply a template when enabling post-call SMS."
                  },
                  "transfer_number": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 32,
                    "description": "E.164 number, null or empty; text limit 32 characters."
                  },
                  "transfer_whisper": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 16000,
                    "description": "Up to 16,000 characters."
                  },
                  "timezone": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Nonempty IANA time zone. When omitted, use the valid account time zone or UTC."
                  },
                  "boosted_keywords": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Customer keyterms: at most 20 nonempty comma-separated terms, at most 50 Unicode characters per trimmed term, and a conservative 450-byte total safety budget for changed values. The text field also has a 2,000-character ceiling. Empty entries do not count; repeated nonempty terms count separately toward 20. Null clears the list. On update, omitted values are retained. An exact unchanged saved string is kept even if it exceeds the newer count, term-length, size or text limits. Any change must meet all current limits.",
                    "x-max-nonempty-comma-terms": 20,
                    "example": "Nixflex, Sam, appointment",
                    "x-max-trimmed-term-codepoints": 50,
                    "x-max-conservative-keyterm-bytes": 450,
                    "x-docs-summary": "Changed values: 20 terms, 50 characters each, 450-byte safety budget. See keyterms rules below."
                  },
                  "voicemail_message": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 600,
                    "description": "Required and nonblank when voicemail_leave_enabled is true; no endpoint default."
                  },
                  "temperature": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 0.7,
                    "description": "0–0.7 inclusive."
                  },
                  "response_eagerness": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "Response delay, 0–1,000 milliseconds."
                  },
                  "stt_confidence": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "0–1; stored compatibility setting."
                  },
                  "stt_max_silence_ms": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2147483647,
                    "description": "0–2,147,483,647 milliseconds; not response delay."
                  },
                  "interruption_sensitivity": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100,
                    "description": "Stored compatibility value; does not tune current interruption decisions."
                  },
                  "max_call_duration_seconds": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 2147483,
                    "description": "Null uses the runtime fallback; it does not mean unlimited."
                  },
                  "silence_hangup_seconds": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 2147483,
                    "description": "Null uses the runtime fallback."
                  },
                  "wait_tag_seconds": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 30,
                    "maximum": 120,
                    "description": "30–120 seconds for a wait tag; null leaves it unset."
                  },
                  "ivr_timeout_seconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1800,
                    "description": "1–1,800 seconds for phone-menu navigation."
                  },
                  "voice_speed": {
                    "type": "number",
                    "minimum": 0.01,
                    "maximum": 100,
                    "description": "Compatibility-only; use speaking_rate."
                  },
                  "speaking_rate": {
                    "oneOf": [
                      {
                        "type": [
                          "number",
                          "null"
                        ]
                      },
                      {
                        "type": "string",
                        "enum": [
                          ""
                        ]
                      }
                    ],
                    "description": "Existing numeric clamp to 0.5..1.5. Null or empty clears."
                  },
                  "pickup_delay": {
                    "description": "Legacy write-through value with no API type or range enforcement. Omit it to retain the current pickup delay."
                  },
                  "dtmf_enabled": {
                    "type": [
                      "boolean",
                      "null"
                    ],
                    "description": "Keypad input; null leaves the preference unset."
                  },
                  "response_length": {
                    "type": "string",
                    "enum": [
                      "short",
                      "medium",
                      "long"
                    ],
                    "description": "`short`, `medium` or `long`."
                  },
                  "transfer_type": {
                    "type": "string",
                    "enum": [
                      "cold",
                      "warm"
                    ],
                    "description": "`cold` or `warm`."
                  },
                  "recording_source": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "provider or nixflex (case/space normalized); null/empty clears to provider."
                  },
                  "data_extraction_fields": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "name",
                        "type"
                      ],
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$",
                          "description": "Unique; __proto__, constructor and prototype forbidden."
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "text",
                            "selector",
                            "boolean",
                            "number"
                          ]
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "optional": {
                          "type": "boolean"
                        },
                        "format_example": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "choices": {
                          "type": "array",
                          "maxItems": 100,
                          "uniqueItems": true,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "description": "Required non-empty for selector; whitespace-only choices rejected."
                        }
                      }
                    },
                    "description": "Up to 50 definitions, described below."
                  },
                  "call_retention_days": {
                    "type": "integer",
                    "description": "Update-only retention in days. Zero means delete eligible content after each call; this is not immediate proof of erasure.",
                    "enum": [
                      90,
                      30,
                      7,
                      1,
                      0
                    ]
                  }
                },
                "additionalProperties": true,
                "minProperties": 1
              },
              "example": {
                "name": "Support",
                "call_retention_days": 30,
                "boosted_keywords": "Nixflex, Sam, appointment"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Agents"
        ],
        "summary": "Disable an agent",
        "operationId": "deleteAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "const": "Agent deleted",
                      "description": "Compatibility wording for switching the agent off."
                    }
                  },
                  "required": [
                    "message"
                  ]
                },
                "example": {
                  "message": "Agent deleted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Agent storage or catalog unavailable; check before retrying a write.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Switch an owned agent off by setting is_active to false. GET still returns the inactive record. This is not permanent erasure."
      }
    },
    "/calls": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "List calls",
        "description": "Read the original call list as a bare array, newest creation time first. Use the history operation when you need filters, totals, failed-start entries or cursor paging. Legacy mode ignores unsupported filters such as agent_id. It has no total or next_cursor. Increase offset by the returned length and stop on an empty/short page within the 200-row cap. Offset reads are not a frozen snapshot; concurrent writes can shift rows. Legacy responses can contain retained transcript/recording fields, so handle them as private account data.",
        "operationId": "listCalls",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Positive parsed integer, capped at 200. Missing, zero, negative or unparseable values use 50.",
              "default": 50,
              "minimum": 1,
              "maximum": 200
            },
            "description": "Positive parsed integer, capped at 200. Missing, zero, negative or unparseable values use 50."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Parsed offset. Missing, negative or unparseable values use zero.",
              "default": 0,
              "minimum": 0
            },
            "description": "Parsed offset. Missing, negative or unparseable values use zero."
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "history selects the history envelope and its different filtering rules. Other values keep the original array."
            },
            "description": "history selects the history envelope and its different filtering rules. Other values keep the original array."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "call_id": {
                            "type": "string",
                            "description": "Call identifier. Failed starts can use the failed: prefix."
                          },
                          "id": {
                            "type": "string",
                            "description": "Row ID of this call record (UUID) when present. Use `call_id` to identify the call in requests.",
                            "format": "uuid"
                          },
                          "agent_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Agent identifier, if retained."
                          },
                          "from_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Origin number, if retained."
                          },
                          "to_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Destination number, if retained."
                          },
                          "call_type": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Call channel/type, such as inbound, outbound or web."
                          },
                          "call_direction": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Direction recorded for the call."
                          },
                          "call_status": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Recorded lifecycle state; unknown future states must be tolerated."
                          },
                          "duration_ms": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Connected duration in milliseconds; not elapsed ringing time or proof of billed time."
                          },
                          "created_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Creation time when retained.",
                            "format": "date-time"
                          },
                          "start_timestamp": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Start time in Unix milliseconds."
                          },
                          "end_timestamp": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "End time in Unix milliseconds."
                          },
                          "answered_at": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Answer time in Unix milliseconds, when known."
                          },
                          "ended_reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Recorded end/failure reason. A null value is unknown, not success."
                          },
                          "call_successful": {
                            "type": [
                              "boolean",
                              "null"
                            ],
                            "description": "Assessment of success. Null means unknown."
                          },
                          "caller_sentiment": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Post-call sentiment, if retained."
                          },
                          "cost": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Stored cost value. Null must remain unknown."
                          },
                          "charged_minutes": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Stored charged-minute value, when known."
                          },
                          "campaign_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Associated campaign, if any."
                          },
                          "test_requested_by": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Retained test source marker, if any."
                          },
                          "caller_name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Caller name, if retained."
                          },
                          "payload_deleted_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Time content was erased.",
                            "format": "date-time"
                          },
                          "payload_deleted_reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Recorded erasure reason."
                          },
                          "payload_in_own_storage": {
                            "type": [
                              "boolean",
                              "null"
                            ],
                            "description": "Whether payload was stored in account-connected storage; its current contents are not inspected."
                          },
                          "call_retention_days": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Retention policy recorded for this call."
                          },
                          "payload_scheduled_for_deletion": {
                            "type": "boolean",
                            "description": "Content is hidden while deletion processing finishes."
                          },
                          "call_summary": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Retained summary; can be absent or null."
                          },
                          "transcript": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Retained transcript; hidden/erased content is null."
                          },
                          "extracted_data": {
                            "description": "Retained extracted JSON data, or null."
                          },
                          "call_events": {
                            "description": "Retained event JSON data, or null."
                          },
                          "recording_url": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Older recording pointer. Prefer the recording endpoint; detail view always returns null."
                          },
                          "recording_status": {
                            "type": "string",
                            "description": "Recording availability state when supplied."
                          },
                          "recording_endpoint": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Optional API path for a recording read; not itself a download URL."
                          },
                          "recording_availability": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Stored recording processing state."
                          },
                          "recording_availability_reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Stored recording processing reason."
                          }
                        },
                        "required": [
                          "call_id"
                        ],
                        "description": "Legacy call rows can include additional fields. Availability varies with retention and lifecycle.",
                        "additionalProperties": true
                      },
                      "description": "Legacy list response."
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "call_id": {
                                "type": "string",
                                "description": "Call identifier. Failed starts can use the failed: prefix."
                              },
                              "id": {
                                "type": "string",
                                "description": "Row ID of this call record (UUID) when present. Use `call_id` to identify the call in requests.",
                                "format": "uuid"
                              },
                              "agent_id": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Agent identifier, if retained."
                              },
                              "from_number": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Origin number, if retained."
                              },
                              "to_number": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Destination number, if retained."
                              },
                              "call_type": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Call channel/type, such as inbound, outbound or web."
                              },
                              "call_direction": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Direction recorded for the call."
                              },
                              "call_status": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Recorded lifecycle state; unknown future states must be tolerated."
                              },
                              "duration_ms": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "description": "Connected duration in milliseconds; not elapsed ringing time or proof of billed time."
                              },
                              "created_at": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Creation time when retained.",
                                "format": "date-time"
                              },
                              "start_timestamp": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "description": "Start time in Unix milliseconds."
                              },
                              "end_timestamp": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "description": "End time in Unix milliseconds."
                              },
                              "answered_at": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "description": "Answer time in Unix milliseconds, when known."
                              },
                              "ended_reason": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Recorded end/failure reason. A null value is unknown, not success."
                              },
                              "call_successful": {
                                "type": [
                                  "boolean",
                                  "null"
                                ],
                                "description": "Assessment of success. Null means unknown."
                              },
                              "caller_sentiment": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Post-call sentiment, if retained."
                              },
                              "cost": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "description": "Stored cost value. Null must remain unknown."
                              },
                              "charged_minutes": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "description": "Stored charged-minute value, when known."
                              },
                              "campaign_id": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Associated campaign, if any."
                              },
                              "test_requested_by": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Retained test source marker, if any."
                              },
                              "caller_name": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Caller name, if retained."
                              },
                              "payload_deleted_at": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Time content was erased.",
                                "format": "date-time"
                              },
                              "payload_deleted_reason": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Recorded erasure reason."
                              },
                              "payload_in_own_storage": {
                                "type": [
                                  "boolean",
                                  "null"
                                ],
                                "description": "Whether payload was stored in account-connected storage; its current contents are not inspected."
                              },
                              "call_retention_days": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "description": "Retention policy recorded for this call."
                              },
                              "payload_scheduled_for_deletion": {
                                "type": "boolean",
                                "description": "Content is hidden while deletion processing finishes."
                              },
                              "call_summary": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Retained summary; can be absent or null."
                              },
                              "recording_availability": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Stored recording processing state."
                              },
                              "recording_availability_reason": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Stored recording processing reason."
                              }
                            },
                            "required": [
                              "call_id"
                            ],
                            "description": "Call metadata and any retained summary. Transcript, event data, extracted data and recording URLs are omitted.",
                            "additionalProperties": true
                          },
                          "description": "Page of matching retained call metadata."
                        },
                        "totals": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "integer",
                              "description": "All matching retained rows, not just this page.",
                              "minimum": 0
                            },
                            "minutes": {
                              "type": "number",
                              "description": "Sum of nonnegative connected durations divided by 60,000."
                            },
                            "cost": {
                              "type": "number",
                              "description": "Sum of known stored costs; unknown costs are counted separately."
                            },
                            "cost_unknown": {
                              "type": "integer",
                              "description": "Matching rows whose cost is unknown.",
                              "minimum": 0
                            },
                            "successful": {
                              "type": "integer",
                              "description": "Matching rows whose success flag is true.",
                              "minimum": 0
                            }
                          },
                          "required": [
                            "total",
                            "minutes",
                            "cost",
                            "cost_unknown",
                            "successful"
                          ],
                          "description": "",
                          "additionalProperties": false
                        },
                        "filters": {
                          "type": "object",
                          "properties": {
                            "direction": {
                              "type": "string",
                              "description": "Filter by direction.",
                              "enum": [
                                "all",
                                "inbound",
                                "outbound",
                                "web"
                              ],
                              "default": "all"
                            },
                            "source": {
                              "type": "string",
                              "description": "Filter by source.",
                              "enum": [
                                "all",
                                "campaign",
                                "web",
                                "test",
                                "other"
                              ],
                              "default": "all"
                            },
                            "outcome": {
                              "type": "string",
                              "description": "Filter by outcome.",
                              "enum": [
                                "all",
                                "successful",
                                "unsuccessful",
                                "unknown",
                                "failed"
                              ],
                              "default": "all"
                            },
                            "period": {
                              "type": "string",
                              "description": "UTC time range: today starts at UTC midnight; week is the preceding 7 days; month the preceding 30 days.",
                              "enum": [
                                "all",
                                "today",
                                "week",
                                "month"
                              ],
                              "default": "month"
                            },
                            "agent": {
                              "type": "string",
                              "description": "Agent ID, or all. This is agent, not agent_id.",
                              "maxLength": 200,
                              "default": "all"
                            },
                            "number": {
                              "type": "string",
                              "description": "Business number, or all; use + in E.164 and encode it in the query.",
                              "maxLength": 80,
                              "default": "all"
                            },
                            "search": {
                              "type": "string",
                              "description": "Trimmed literal search in caller name, call ID and phone numbers. Control characters are invalid.",
                              "maxLength": 120,
                              "default": ""
                            },
                            "since": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Optional ISO timestamp with a time zone. Overrides the period start; must not be after until.",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "until": {
                              "type": "string",
                              "description": "Optional ISO timestamp with a time zone; defaults to request time.",
                              "format": "date-time",
                              "maxLength": 40
                            }
                          },
                          "required": [
                            "direction",
                            "source",
                            "outcome",
                            "period",
                            "agent",
                            "number",
                            "search",
                            "since",
                            "until"
                          ],
                          "description": "",
                          "additionalProperties": false
                        },
                        "limit": {
                          "type": "integer",
                          "description": "Applied page limit."
                        },
                        "offset": {
                          "type": "integer",
                          "description": "Applied offset; zero during cursor continuation."
                        },
                        "has_more": {
                          "type": "boolean",
                          "description": "Whether another page exists."
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Opaque continuation, or null at the end."
                        }
                      },
                      "required": [
                        "data",
                        "totals",
                        "filters",
                        "limit",
                        "offset",
                        "has_more",
                        "next_cursor"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  ]
                },
                "example": []
              }
            }
          },
          "400": {
            "description": "invalid_call_history: A history-mode query is invalid. Use the history filter/cursor rules when view=history.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "server_error: Legacy call rows could not be read. Retry a bounded read after recovery.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "call_data_unavailable: History data could not be confirmed. Retry the read; do not turn the failure into an empty page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Calls"
        ],
        "summary": "Delete all calls",
        "operationId": "deleteAllCalls",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Guarded call cleanup request; does not delete SMS or close the account. Can refuse with 409/503 while work or cleanup confirmation is pending. Legacy recording counters are not all-copy erasure proof. Never blindly retry an uncertain response.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    },
                    "calls_deleted": {
                      "type": "integer"
                    },
                    "recordings_deleted": {
                      "type": "integer"
                    },
                    "sms_deleted": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/calls/{id}": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Get a call",
        "description": "Read one account-owned call. Use view=detail for the explicit nullable detail shape, failed-start IDs and retained metadata stubs. Omitting view keeps the original row response. Nullable fields remain null; a retained stub may omit fields. Detail mode masks expired or scheduled-for-deletion content and always returns recording_url: null. Use the recording endpoint for a fresh link. This read does not restore erased content. The response example is illustrative, not a claim that a recording exists.",
        "operationId": "getCall",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Call ID from this account. Detail mode accepts up to 200 characters, including failed: IDs.",
              "maxLength": 200
            },
            "description": "Call ID from this account. Detail mode accepts up to 200 characters, including failed: IDs."
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "detail selects the explicit detail response. Omitted or another value selects the original response."
            },
            "description": "detail selects the explicit detail response. Omitted or another value selects the original response."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "call_id": {
                          "type": "string",
                          "description": "Call identifier. Failed starts can use the failed: prefix."
                        },
                        "id": {
                          "type": "string",
                          "description": "Row ID of this call record (UUID) when present. Use `call_id` to identify the call in requests.",
                          "format": "uuid"
                        },
                        "agent_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Agent identifier, if retained."
                        },
                        "from_number": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Origin number, if retained."
                        },
                        "to_number": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Destination number, if retained."
                        },
                        "call_type": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Call channel/type, such as inbound, outbound or web."
                        },
                        "call_direction": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Direction recorded for the call."
                        },
                        "call_status": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Recorded lifecycle state; unknown future states must be tolerated."
                        },
                        "duration_ms": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Connected duration in milliseconds; not elapsed ringing time or proof of billed time."
                        },
                        "created_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Creation time when retained.",
                          "format": "date-time"
                        },
                        "start_timestamp": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Start time in Unix milliseconds."
                        },
                        "end_timestamp": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "End time in Unix milliseconds."
                        },
                        "answered_at": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Answer time in Unix milliseconds, when known."
                        },
                        "ended_reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Recorded end/failure reason. A null value is unknown, not success."
                        },
                        "call_successful": {
                          "type": [
                            "boolean",
                            "null"
                          ],
                          "description": "Assessment of success. Null means unknown."
                        },
                        "caller_sentiment": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Post-call sentiment, if retained."
                        },
                        "cost": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Stored cost value. Null must remain unknown."
                        },
                        "charged_minutes": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Stored charged-minute value, when known."
                        },
                        "campaign_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Associated campaign, if any."
                        },
                        "test_requested_by": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Retained test source marker, if any."
                        },
                        "caller_name": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Caller name, if retained."
                        },
                        "payload_deleted_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Time content was erased.",
                          "format": "date-time"
                        },
                        "payload_deleted_reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Recorded erasure reason."
                        },
                        "payload_in_own_storage": {
                          "type": [
                            "boolean",
                            "null"
                          ],
                          "description": "Whether payload was stored in account-connected storage; its current contents are not inspected."
                        },
                        "call_retention_days": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Retention policy recorded for this call."
                        },
                        "payload_scheduled_for_deletion": {
                          "type": "boolean",
                          "description": "Content is hidden while deletion processing finishes."
                        },
                        "call_summary": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Retained summary; can be absent or null."
                        },
                        "transcript": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Retained transcript; hidden/erased content is null."
                        },
                        "extracted_data": {
                          "description": "Retained extracted JSON data, or null."
                        },
                        "call_events": {
                          "description": "Retained event JSON data, or null."
                        },
                        "recording_url": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Older recording pointer. Prefer the recording endpoint; detail view always returns null."
                        },
                        "recording_status": {
                          "type": "string",
                          "description": "Recording availability state when supplied."
                        },
                        "recording_endpoint": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Optional API path for a recording read; not itself a download URL."
                        },
                        "recording_availability": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Stored recording processing state."
                        },
                        "recording_availability_reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Stored recording processing reason."
                        }
                      },
                      "required": [
                        "call_id"
                      ],
                      "description": "Legacy call rows can include additional fields. Availability varies with retention and lifecycle.",
                      "additionalProperties": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "call_id": {
                          "type": "string",
                          "description": "Call identifier. Failed starts can use the failed: prefix."
                        },
                        "id": {
                          "type": "string",
                          "description": "Row ID of this call record (UUID) when present. Use `call_id` to identify the call in requests.",
                          "format": "uuid"
                        },
                        "agent_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Agent identifier, if retained."
                        },
                        "from_number": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Origin number, if retained."
                        },
                        "to_number": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Destination number, if retained."
                        },
                        "call_type": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Call channel/type, such as inbound, outbound or web."
                        },
                        "call_direction": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Direction recorded for the call."
                        },
                        "call_status": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Recorded lifecycle state; unknown future states must be tolerated."
                        },
                        "duration_ms": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Connected duration in milliseconds; not elapsed ringing time or proof of billed time."
                        },
                        "created_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Creation time when retained.",
                          "format": "date-time"
                        },
                        "start_timestamp": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Start time in Unix milliseconds."
                        },
                        "end_timestamp": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "End time in Unix milliseconds."
                        },
                        "answered_at": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Answer time in Unix milliseconds, when known."
                        },
                        "ended_reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Recorded end/failure reason. A null value is unknown, not success."
                        },
                        "call_successful": {
                          "type": [
                            "boolean",
                            "null"
                          ],
                          "description": "Assessment of success. Null means unknown."
                        },
                        "caller_sentiment": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Post-call sentiment, if retained."
                        },
                        "cost": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Stored cost value. Null must remain unknown."
                        },
                        "charged_minutes": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Stored charged-minute value, when known."
                        },
                        "campaign_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Associated campaign, if any."
                        },
                        "test_requested_by": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Retained test source marker, if any."
                        },
                        "caller_name": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Caller name, if retained."
                        },
                        "payload_deleted_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Time content was erased.",
                          "format": "date-time"
                        },
                        "payload_deleted_reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Recorded erasure reason."
                        },
                        "payload_in_own_storage": {
                          "type": [
                            "boolean",
                            "null"
                          ],
                          "description": "Whether payload was stored in account-connected storage; its current contents are not inspected."
                        },
                        "call_retention_days": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Retention policy recorded for this call."
                        },
                        "payload_scheduled_for_deletion": {
                          "type": "boolean",
                          "description": "Content is hidden while deletion processing finishes."
                        },
                        "call_summary": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Retained summary; can be absent or null."
                        },
                        "transcript": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Retained transcript; hidden/erased content is null."
                        },
                        "extracted_data": {
                          "description": "Retained extracted JSON data, or null."
                        },
                        "call_events": {
                          "description": "Retained event JSON data, or null."
                        },
                        "recording_url": {
                          "type": "null",
                          "description": "Detail view never returns a raw recording URL. Use Get a call recording."
                        },
                        "recording_status": {
                          "type": "string",
                          "description": "Recording availability state when supplied."
                        },
                        "recording_availability": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Stored recording processing state."
                        },
                        "recording_availability_reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Stored recording processing reason."
                        }
                      },
                      "required": [
                        "call_id"
                      ],
                      "description": "Detail reads include failed starts and retained metadata stubs. Fields can be omitted on stubs; null does not mean zero or success.",
                      "additionalProperties": true
                    }
                  ]
                },
                "example": {
                  "call_id": "call_example",
                  "agent_id": "agent_0123456789abcdef",
                  "call_status": "completed",
                  "duration_ms": 45000,
                  "call_successful": null,
                  "call_summary": null,
                  "transcript": null,
                  "recording_url": null,
                  "recording_status": "unknown"
                }
              }
            }
          },
          "400": {
            "description": "invalid_call_id: The detail-mode ID is empty or exceeds 200 characters. Use the exact ID returned by a list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: The call is absent, explicitly deleted or owned by another account. Check the account and call ID; do not infer another account’s data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "call_data_unavailable: Call data could not be read safely. Retry the read after recovery; absence has not been proved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Calls"
        ],
        "summary": "Delete a call",
        "operationId": "deleteCall",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Hang up a running owned call, then remove its content. Recording cleanup can remain queued after content deletion. Owner and Admin may delete; Member may not. Used charges and required financial evidence remain; no refund is made. A hangup_pending response queues durable completion without waiting for settlement. Repeating the same DELETE safely resumes the same request. A lost response is not confirmed success. Customer-managed copies are outside this operation. Bulk call deletion and account closure have separate contracts.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Owned call identifier. Missing and foreign IDs have the same 404.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Call content deleted. Recording cleanup has its own explicit state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "call_id",
                    "deleted",
                    "recording_deleted",
                    "recording_cleanup"
                  ],
                  "properties": {
                    "call_id": {
                      "type": "string",
                      "description": "The owned call ID from the request."
                    },
                    "deleted": {
                      "type": "boolean",
                      "const": true,
                      "description": "The call content has been removed from customer views after confirmed hang-up."
                    },
                    "recording_deleted": {
                      "type": "boolean",
                      "description": "True only when the Nixflex recording copy is confirmed absent. This is not proof of carrier or customer-storage erasure."
                    },
                    "recording_cleanup": {
                      "type": "string",
                      "enum": [
                        "carrier_best_effort",
                        "queued"
                      ],
                      "description": "queued means Nixflex-copy cleanup is still tracked. carrier_best_effort means that copy is confirmed absent; carrier cleanup remains best effort."
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "cleaned": {
                    "value": {
                      "call_id": "call_example",
                      "deleted": true,
                      "recording_deleted": true,
                      "recording_cleanup": "carrier_best_effort"
                    }
                  },
                  "cleanup_queued": {
                    "value": {
                      "call_id": "call_example",
                      "deleted": true,
                      "recording_deleted": false,
                      "recording_cleanup": "queued"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_delete: The identifier must contain 1–200 characters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "invalid_delete"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "invalid_delete": {
                    "value": {
                      "error": {
                        "type": "invalid_request",
                        "code": "invalid_delete",
                        "message": "Choose a valid call or campaign.",
                        "doc_url": "https://docs.nixflex.com/errors/invalid_delete",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Owner or Admin authority is required. A Member cannot delete content.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "permission_denied"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "permission_denied": {
                    "value": {
                      "error": {
                        "type": "permission_denied",
                        "code": "permission_denied",
                        "message": "Only an Admin or the Owner can do this.",
                        "doc_url": "https://docs.nixflex.com/errors/permission_denied",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: The item is missing or belongs to another account. These cases have the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "not_found"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "not_found": {
                    "value": {
                      "error": {
                        "type": "not_found",
                        "code": "not_found",
                        "message": "Call not found.",
                        "doc_url": "https://docs.nixflex.com/errors/not_found",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "hangup_pending: Hang-up is unconfirmed and durable deletion will continue. deletion_unavailable: The result could not be confirmed; check the list and repeat the same DELETE to resume any existing request safely.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "hangup_pending",
                            "deletion_unavailable"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "hangup_pending": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "hangup_pending",
                        "message": "The call has not confirmed it ended yet. Deletion is queued and will finish once hang-up is confirmed.",
                        "doc_url": "https://docs.nixflex.com/errors/hangup_pending",
                        "details": {
                          "deleted": false,
                          "retry_pending": true
                        }
                      }
                    }
                  },
                  "deletion_unavailable": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "deletion_unavailable",
                        "message": "Deletion could not be confirmed. Check the list and try Delete again; an existing request will safely resume.",
                        "doc_url": "https://docs.nixflex.com/errors/deletion_unavailable",
                        "details": {
                          "deleted": false
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/calls/outbound": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Create an outbound call",
        "description": "Start one outbound call from an account-owned number assigned to an active agent. A 201 response means the call was initiated; it does not confirm connection, conversation, completion or a successful outcome. Only send to a recipient you are authorised to contact. This endpoint has no dry-run option. The examples use an explicit recipient variable and can place a real call when run. Optional recipient location values do not override suppression, contact hours or capacity rules.\n\nUse dynamic_vars for single-call substitutions; campaign recipient variables are a different field. There is no fallback to an agent-level phone_number. When from_number is omitted, selection uses the oldest eligible number by creation time then row ID. Selection does not bypass the final ownership and availability checks. Contact-hours refusals use error.code outside_hours or needs_timezone (409), or contact_policy_unavailable (503). Details include outcome:not_sent, sent:false and charged:false. Advisory messages can instead start “Outside calling hours” or “Weekend where they are” and contain the next local window. refused_before_dispatch is a dispatch outcome marker, not an HTTP status or a replacement error.code. An unknown outcome can still mean something was sent. Optional request_id enables one durable account-scoped call intent. Required prompt and existing behavior without request_id remain unchanged. Save the UUID before sending; same input and ID can replay a recorded acceptance, but pending/unknown never dispatch again. A new UUID is a new explicit call intent, not a retry strategy.",
        "operationId": "createOutboundCall",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "The same accepted request was replayed. No second dispatch; the response omits original to/from fields.",
            "headers": {
              "Cache-Control": {
                "description": "Do not cache private request or booking state.",
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "required": [
                    "call_id",
                    "request_id",
                    "status",
                    "replayed"
                  ],
                  "properties": {
                    "call_id": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
                      "description": "Account-scoped UUID for one call intent. Save it before sending. Reusing it never starts a second call; changed input conflicts."
                    },
                    "status": {
                      "type": "string",
                      "const": "initiated"
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "examples": {
                  "replayed": {
                    "value": {
                      "call_id": "call_example",
                      "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
                      "status": "initiated",
                      "replayed": true
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Call initiated, not completed. With request_id, save both IDs. request_status:unconfirmed still preserves the known accepted call and safe_to_retry:false.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "call_id": {
                      "type": "string",
                      "description": "Accepted call identifier. Save it for reads and reconciliation."
                    },
                    "status": {
                      "type": "string",
                      "description": "The call was initiated, not completed.",
                      "const": "initiated"
                    },
                    "to": {
                      "type": "string",
                      "description": "Requested recipient."
                    },
                    "from": {
                      "type": "string",
                      "description": "Selected originating number."
                    },
                    "work_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Optional account work receipt ID."
                    },
                    "deletion_work_id": {
                      "type": "string",
                      "description": "Optional dispatch/deletion safety receipt ID."
                    },
                    "persistence": {
                      "type": "string",
                      "description": "Optional unconfirmed state if accepted work could not be fully saved.",
                      "const": "unconfirmed"
                    },
                    "safe_to_retry": {
                      "type": "boolean",
                      "description": "When supplied, false: do not repeat an accepted or uncertain call.",
                      "const": false
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
                      "description": "Present when this launch supplied request_id. Keep it for reconciliation."
                    },
                    "request_status": {
                      "type": "string",
                      "const": "unconfirmed",
                      "description": "The call ID is known but its final journal acknowledgement was not confirmed. Never redial automatically."
                    }
                  },
                  "required": [
                    "call_id",
                    "status",
                    "to",
                    "from"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "examples": {
                  "legacy": {
                    "value": {
                      "call_id": "call_example",
                      "status": "initiated",
                      "to": "+12025550101",
                      "from": "+12025550100"
                    }
                  },
                  "journalled": {
                    "value": {
                      "call_id": "call_example",
                      "status": "initiated",
                      "to": "+12025550101",
                      "from": "+12025550100",
                      "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082"
                    }
                  },
                  "unconfirmed": {
                    "value": {
                      "call_id": "call_example",
                      "status": "initiated",
                      "to": "+12025550101",
                      "from": "+12025550100",
                      "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
                      "request_status": "unconfirmed",
                      "safe_to_retry": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "missing_field: agent_id, to_number or a nonblank prompt is missing. Supply the required fields before attempting a call. invalid_phone_format: The recipient is not valid E.164. Correct the recipient number. agent_missing_phone_number: No eligible outbound number is assigned to the agent. Connect and enable an owned outbound number. from_number_not_found: The requested origin is not an eligible number of this agent. Use an owned, assigned and settled origin. from_number_required: Your organisation requires an explicit sender and this agent has two or more attached numbers. Send the customer’s from_number. invalid_prompt_validation: prompt_validation was sent with a value other than \"strict\". Send \"strict\" or omit the field. invalid_prompt: With strict validation, prompt is not text. Send the call purpose as a string. prompt_too_short: With strict validation, the nonblank purpose is under 10 characters after trimming; nothing was dialled. Describe the call purpose in at least 10 characters. invalid_request_id: The supplied request_id is not a supported UUID. Create and save one valid UUID for the deliberate call intent before its first submission.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "examples": {
                  "invalid_request_id": {
                    "value": {
                      "error": {
                        "type": "invalid_request",
                        "code": "invalid_request_id",
                        "message": "The supplied request_id is not a supported UUID.",
                        "doc_url": "https://docs.nixflex.com/errors/invalid_request_id",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "account_disabled: The account cannot start calls. Resolve account access.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: The agent is not available to this account. Use an owned agent ID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "agent_inactive: The agent is disabled. Choose or enable the intended agent before sending. number_pending: The number is being imported or removed. Wait for the number operation to settle. number_disabled: Outbound work is disabled for the number. Check the intended outbound setting; do not reroute automatically. number_context_changed: The number assignment changed while the call waited. Read the current assignment before a new request. number_provider_invalid: The number connection is not valid. Repair the existing connection through the dashboard. do_not_contact: The recipient is suppressed. Respect the suppression; do not fabricate consent. missing_voice_details: A call-purpose placeholder has no value. Supply the named dynamic_vars values. unsupported_voice_placeholder: A placeholder name uses unsupported spaces or punctuation. Use {{name}} with a supported identifier. needs_timezone: The recipient location does not establish a usable time zone. Supply the recipient time zone after checking it. invalid_recipient_timezone: The recipient time zone is invalid. Use a valid IANA time zone. invalid_recipient_country: The recipient country is invalid. Use a valid two-letter country code. outside_hours: The recipient is outside permitted contact hours. Wait for an allowed window; do not bypass the policy. not_due_local: The recipient is not due for contact in the current local window. Follow the returned contact-hours guidance. country_policy_review: The recipient country requires policy review. Resolve that review before contacting the recipient. holiday_data_unavailable: Holiday checks could not confirm an allowed window. Wait for a confirmed policy result. public_holiday: The recipient-local date is a restricted holiday. Use the next permitted contact window. request_id_conflict: This account already used the UUID with different call details. Reconcile the existing request. Do not change its payload or automatically allocate a replacement ID. outbound_request_pending: The same call request is still pending. Read the same request ID and call history. Wait; do not submit a new call. outbound_request_unknown: The saved request has an uncertain outcome. Retain its UUID and check call history. Never automatically redial with a new ID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false,
                  "allOf": [
                    {
                      "if": {
                        "properties": {
                          "error": {
                            "properties": {
                              "code": {
                                "enum": [
                                  "outbound_request_pending",
                                  "outbound_request_unknown"
                                ]
                              }
                            },
                            "required": [
                              "code"
                            ]
                          }
                        },
                        "required": [
                          "error"
                        ]
                      },
                      "then": {
                        "properties": {
                          "error": {
                            "required": [
                              "details"
                            ],
                            "properties": {
                              "details": {
                                "type": "object",
                                "required": [
                                  "request_id",
                                  "state",
                                  "safe_to_retry"
                                ],
                                "properties": {
                                  "request_id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
                                    "description": "Account-scoped UUID for one call intent. Save it before sending. Reusing it never starts a second call; changed input conflicts."
                                  },
                                  "state": {
                                    "enum": [
                                      "pending",
                                      "unknown"
                                    ]
                                  },
                                  "safe_to_retry": {
                                    "const": false
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "needs_timezone": {
                    "summary": "needs_timezone (message may include local-window advice)",
                    "value": {
                      "error": {
                        "type": "conflict",
                        "code": "needs_timezone",
                        "message": "Time zone unknown - add their time zone or country. Nothing was sent or charged for this attempt.",
                        "doc_url": "https://docs.nixflex.com/errors/needs_timezone",
                        "details": {
                          "outcome": "not_sent",
                          "sent": false,
                          "charged": false,
                          "safe_to_retry": false
                        }
                      }
                    }
                  },
                  "outside_hours": {
                    "summary": "outside_hours (message may include local-window advice)",
                    "value": {
                      "error": {
                        "type": "conflict",
                        "code": "outside_hours",
                        "message": "This recipient is outside the permitted local contact hours. Nothing was sent or charged for this attempt.",
                        "doc_url": "https://docs.nixflex.com/errors/outside_hours",
                        "details": {
                          "outcome": "not_sent",
                          "sent": false,
                          "charged": false,
                          "safe_to_retry": false
                        }
                      }
                    }
                  },
                  "request_id_conflict": {
                    "value": {
                      "error": {
                        "type": "conflict",
                        "code": "request_id_conflict",
                        "message": "This account already used the UUID with different call details.",
                        "doc_url": "https://docs.nixflex.com/errors/request_id_conflict",
                        "details": {}
                      }
                    }
                  },
                  "outbound_request_pending": {
                    "value": {
                      "error": {
                        "type": "conflict",
                        "code": "outbound_request_pending",
                        "message": "The same call request is still pending.",
                        "doc_url": "https://docs.nixflex.com/errors/outbound_request_pending",
                        "details": {
                          "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
                          "state": "pending",
                          "safe_to_retry": false
                        }
                      }
                    }
                  },
                  "outbound_request_unknown": {
                    "value": {
                      "error": {
                        "type": "conflict",
                        "code": "outbound_request_unknown",
                        "message": "The saved request has an uncertain outcome.",
                        "doc_url": "https://docs.nixflex.com/errors/outbound_request_unknown",
                        "details": {
                          "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
                          "state": "unknown",
                          "safe_to_retry": false
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The whole JSON request is over 100 KB. Shorten the call purpose or variables and send a smaller request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "carrier_error: The connection service refused the call. Read the refusal and correct the cause; do not blindly redial.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "agent_lookup_unavailable: The agent lookup failed. Retry only after checking that no call was accepted. number_lookup_unavailable: Number ownership or availability could not be confirmed. Check current state before another send. contact_policy_unavailable: Contact policy could not be checked. Wait for recovery; do not automatically retry a send. dispatch_safety_unavailable: Dispatch safety could not be confirmed. Reconcile any existing receipt before deciding on a new request. outbound_request_unknown: The call result or its final journal update could not be confirmed. Treat the outcome as unknown and preserve request_id. Check its status before another deliberate intent. outbound_request_unavailable: The request journal could not be checked. For a launch, retain unknown and safe_to_retry:false: an earlier attempt may have dialled. Retry the status read, not a new launch.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false,
                  "allOf": [
                    {
                      "if": {
                        "properties": {
                          "error": {
                            "properties": {
                              "code": {
                                "enum": [
                                  "outbound_request_unknown",
                                  "outbound_request_unavailable"
                                ]
                              }
                            },
                            "required": [
                              "code"
                            ]
                          }
                        },
                        "required": [
                          "error"
                        ]
                      },
                      "then": {
                        "properties": {
                          "error": {
                            "required": [
                              "details"
                            ],
                            "properties": {
                              "details": {
                                "type": "object",
                                "required": [
                                  "request_id",
                                  "state",
                                  "safe_to_retry"
                                ],
                                "properties": {
                                  "request_id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
                                    "description": "Account-scoped UUID for one call intent. Save it before sending. Reusing it never starts a second call; changed input conflicts."
                                  },
                                  "state": {
                                    "enum": [
                                      "unknown"
                                    ]
                                  },
                                  "safe_to_retry": {
                                    "const": false
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "contact_policy_unavailable": {
                    "summary": "contact_policy_unavailable (message may include local-window advice)",
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "contact_policy_unavailable",
                        "message": "Contact hours could not be checked. Try again later. Nothing was sent or charged for this attempt.",
                        "doc_url": "https://docs.nixflex.com/errors/contact_policy_unavailable",
                        "details": {
                          "outcome": "not_sent",
                          "sent": false,
                          "charged": false,
                          "safe_to_retry": true
                        }
                      }
                    }
                  },
                  "outbound_request_unknown": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "outbound_request_unknown",
                        "message": "The call result or its final journal update could not be confirmed.",
                        "doc_url": "https://docs.nixflex.com/errors/outbound_request_unknown",
                        "details": {
                          "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
                          "state": "unknown",
                          "safe_to_retry": false
                        }
                      }
                    }
                  },
                  "outbound_request_unavailable": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "outbound_request_unavailable",
                        "message": "The request journal could not be checked.",
                        "doc_url": "https://docs.nixflex.com/errors/outbound_request_unavailable",
                        "details": {
                          "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
                          "state": "unknown",
                          "safe_to_retry": false
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "carrier_outcome_unknown: The service did not confirm whether a call was placed. Check call history and receipts; never automatically redial.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent_id": {
                    "type": "string",
                    "description": "Owned active agent ID.",
                    "minLength": 1
                  },
                  "to_number": {
                    "type": "string",
                    "description": "Recipient in E.164 format.",
                    "minLength": 1
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Send a purpose of at least 10 characters after trimming. No separate maximum; the whole JSON request must be under 100 KB. Without prompt_validation:\"strict\" a shorter nonblank purpose can pass request validation, but the call is instructed to end.",
                    "minLength": 10
                  },
                  "prompt_validation": {
                    "type": "string",
                    "enum": [
                      "strict"
                    ],
                    "description": "Optional. Only \"strict\": a nonblank purpose under 10 trimmed characters gets 400 prompt_too_short and a non-text prompt gets 400 invalid_prompt, before dialling. Any other value, including null or an empty string, gets 400 invalid_prompt_validation."
                  },
                  "from_number": {
                    "type": "string",
                    "description": "Optional owned outbound-enabled number assigned to this agent. If omitted, the oldest eligible number is selected."
                  },
                  "dynamic_vars": {
                    "type": "object",
                    "properties": {},
                    "description": "Values for {{name}} placeholders. Choose case-sensitive custom names using ASCII letters, digits and underscores. Reserved call variables are filled by the engine. Supply other referenced values per recipient.",
                    "additionalProperties": true
                  },
                  "campaign_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Optional campaign association. Omitted or empty becomes null.",
                    "default": null
                  },
                  "recipient_timezone": {
                    "type": "string",
                    "description": "Optional recipient IANA time zone. Used for recipient-local contact checks, not the business clock."
                  },
                  "recipient_country": {
                    "type": "string",
                    "description": "Optional two-letter recipient country code."
                  },
                  "request_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
                    "description": "Account-scoped UUID for one call intent. Save it before sending. Reusing it never starts a second call; changed input conflicts."
                  }
                },
                "required": [
                  "agent_id",
                  "to_number",
                  "prompt"
                ],
                "description": "",
                "additionalProperties": false
              },
              "examples": {
                "legacy": {
                  "value": {
                    "agent_id": "agent_example",
                    "to_number": "+12025550101",
                    "prompt": "Confirm the appointment time requested by the recipient."
                  }
                },
                "journalled": {
                  "value": {
                    "agent_id": "agent_example",
                    "to_number": "+12025550101",
                    "prompt": "Confirm the appointment time requested by the recipient.",
                    "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/calls/batch": {
      "post": {
        "operationId": "createBatchCampaign",
        "summary": "Create a voice campaign",
        "description": "Create a voice campaign and its recipient rows. The default now mode immediately requests launch; schedule mode saves scheduled work that can run automatically. There is no public draft-only flag. ### Scheduling, consent and duplicate rows\n\nThe scheduler and final contact checks use recipient-local eligibility, consent, suppression and capacity. A campaign time zone is not a substitute for an unknown recipient location. Preview contact hours before saving; a preview is advisory. Wider hours require the recorded explanation and remain subject to policy.\n\nChoose duplicate_policy deliberately. reject refuses repeated accepted numbers, allow keeps every row, and warn reports duplicates but still allows this route to request launch. The duplicate_choice_required response flag is advisory. It does not create a safe draft or block sending.\n\nThe scheduled example can contact its recipients when due. Use an approved destination and consent; the date is illustrative. No public draft-only flag is accepted. DELETE /v1/calls/batch/{id} requests guarded deletion. The cancel and resume routes control eligible work on the current launch. Reuse replaces the recipient list and settings only while the owned campaign has never launched.\n\nJSON request size and database constraints can limit a request before the maximum accepted-recipient count. No additional text length limit is declared for the prompt or message template on this route.",
        "tags": [
          "Voice campaigns"
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "campaign_id": {
                          "type": "string",
                          "description": "Saved campaign ID."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Original input row count."
                        },
                        "total_recipients": {
                          "type": "integer",
                          "description": "Accepted saved rows."
                        },
                        "valid_count": {
                          "type": "integer",
                          "description": "Accepted recipient rows."
                        },
                        "invalid_count": {
                          "type": "integer",
                          "description": "Rejected phone rows."
                        },
                        "invalid": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "phone": {
                                "description": "Original rejected phone input, which may be null or a non-string value."
                              },
                              "reason": {
                                "type": "string",
                                "description": "Why this row failed."
                              },
                              "row_index": {
                                "type": "integer",
                                "description": "Zero-based original row.",
                                "minimum": 0
                              },
                              "variables": {
                                "type": "object",
                                "properties": {},
                                "description": "Original variables when present.",
                                "additionalProperties": true
                              }
                            },
                            "required": [
                              "phone",
                              "reason",
                              "row_index"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "description": ""
                        },
                        "duplicates": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "phone": {
                                "type": "string",
                                "description": "International number with + and digits; no spaces.",
                                "pattern": "^\\+[1-9][0-9]{6,14}$"
                              },
                              "row_indices": {
                                "type": "array",
                                "items": {
                                  "type": "integer",
                                  "description": "Zero-based original input row.",
                                  "minimum": 0
                                },
                                "description": ""
                              },
                              "different_content": {
                                "type": "boolean",
                                "description": "Duplicate rows have different variables or prompts."
                              }
                            },
                            "required": [
                              "phone",
                              "row_indices",
                              "different_content"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "description": "Repeated accepted destinations."
                        },
                        "duplicate_policy": {
                          "type": "string",
                          "description": "Applied duplicate decision.",
                          "enum": [
                            "allow",
                            "warn",
                            "reject"
                          ]
                        },
                        "duplicate_choice_required": {
                          "type": "boolean",
                          "description": "Advisory flag for repeated rows under warn; it is not a server-side launch lock."
                        },
                        "status": {
                          "type": "string",
                          "description": "Saved campaign state."
                        }
                      },
                      "required": [
                        "campaign_id",
                        "total",
                        "total_recipients",
                        "valid_count",
                        "invalid_count",
                        "invalid",
                        "status",
                        "duplicates",
                        "duplicate_policy",
                        "duplicate_choice_required"
                      ],
                      "description": "",
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "campaign_id": {
                          "type": "string",
                          "description": "Saved campaign ID."
                        },
                        "status": {
                          "type": "string",
                          "description": "Usually running; queue admission is not completed calls."
                        },
                        "valid_count": {
                          "type": "integer",
                          "description": "Accepted recipient rows."
                        },
                        "invalid_count": {
                          "type": "integer",
                          "description": "Rejected phone rows."
                        },
                        "invalid": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "phone": {
                                "description": "Original rejected phone input, which may be null or a non-string value."
                              },
                              "reason": {
                                "type": "string",
                                "description": "Why this row failed."
                              },
                              "row_index": {
                                "type": "integer",
                                "description": "Zero-based original row.",
                                "minimum": 0
                              },
                              "variables": {
                                "type": "object",
                                "properties": {},
                                "description": "Original variables when present.",
                                "additionalProperties": true
                              }
                            },
                            "required": [
                              "phone",
                              "reason",
                              "row_index"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "description": ""
                        },
                        "duplicates": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "phone": {
                                "type": "string",
                                "description": "International number with + and digits; no spaces.",
                                "pattern": "^\\+[1-9][0-9]{6,14}$"
                              },
                              "row_indices": {
                                "type": "array",
                                "items": {
                                  "type": "integer",
                                  "description": "Zero-based original input row.",
                                  "minimum": 0
                                },
                                "description": ""
                              },
                              "different_content": {
                                "type": "boolean",
                                "description": "Duplicate rows have different variables or prompts."
                              }
                            },
                            "required": [
                              "phone",
                              "row_indices",
                              "different_content"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "description": "Repeated accepted destinations."
                        },
                        "duplicate_policy": {
                          "type": "string",
                          "description": "Applied duplicate decision.",
                          "enum": [
                            "allow",
                            "warn",
                            "reject"
                          ]
                        },
                        "duplicate_choice_required": {
                          "type": "boolean",
                          "description": "Advisory flag for repeated rows under warn; it is not a server-side launch lock."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Original input rows."
                        },
                        "dialed": {
                          "type": "integer",
                          "description": "Count of enqueued jobs, not actual calls."
                        },
                        "queued": {
                          "type": "integer",
                          "description": "Enqueued jobs."
                        },
                        "failed": {
                          "type": "integer",
                          "description": "Confirmed enqueue failures."
                        },
                        "message": {
                          "type": "string",
                          "description": "Queue admission explanation."
                        }
                      },
                      "required": [
                        "campaign_id",
                        "status",
                        "valid_count",
                        "invalid_count",
                        "invalid",
                        "dialed",
                        "queued",
                        "failed",
                        "message"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  ],
                  "description": "Scheduled creation or immediate launch result."
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "total": 1,
                  "total_recipients": 1,
                  "valid_count": 1,
                  "invalid_count": 0,
                  "invalid": [],
                  "status": "scheduled",
                  "duplicates": [],
                  "duplicate_policy": "reject",
                  "duplicate_choice_required": false
                }
              }
            }
          },
          "400": {
            "description": "missing_field: A nonblank prompt is missing. campaign_creation_failed: Required settings, ownership, template values, duplicate policy or recipient metadata failed validation. invalid_phone_format: Phone validation failed or no valid recipients remain. campaign_launch_failed: Creation succeeded but immediate launch was refused. invalid_json: Invalid JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "number_disabled: Outbound voice is disabled for the campaign number.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request exceeds the JSON body limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "campaign_outcome_unknown: A campaign save or launch result is uncertain. server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "campaigns_paused: Campaign admission is temporarily paused.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent_id": {
                    "type": "string",
                    "description": "Active agent owned by this account."
                  },
                  "from_number": {
                    "type": "string",
                    "description": "International number with + and digits; no spaces.",
                    "pattern": "^\\+[1-9][0-9]{6,14}$"
                  },
                  "name": {
                    "type": "string",
                    "description": "Campaign label. Empty or omitted uses the channel-specific Untitled campaign label."
                  },
                  "recipients": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "phone": {
                          "type": "string",
                          "description": "Trimmed E.164 string, 8–15 digits after +; country numbering-plan validation also applies.",
                          "pattern": "^\\+[1-9][0-9]{7,14}$"
                        },
                        "variables": {
                          "type": "object",
                          "properties": {},
                          "description": "Per-recipient template values.",
                          "additionalProperties": true,
                          "default": {}
                        },
                        "country": {
                          "type": "string",
                          "description": "Uppercase supported two-letter country. Omitted uses conservative number inference.",
                          "minLength": 2,
                          "maxLength": 2
                        },
                        "timezone": {
                          "type": "string",
                          "description": "Explicit recipient IANA Area/City zone; preferred over number inference. Unknown location is held, never replaced by the campaign clock.",
                          "maxLength": 80
                        },
                        "prompt_override": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Optional instructions for this recipient instead of the campaign prompt. Empty inherits the campaign prompt. No separate maximum; it counts toward the 100 KB request limit.",
                          "default": null
                        }
                      },
                      "required": [
                        "phone"
                      ],
                      "description": "",
                      "additionalProperties": false
                    },
                    "description": "At least one accepted recipient; send at most 1,000 recipients per campaign (the whole request must stay under 100 KB). For a bigger list, create several campaigns.",
                    "minItems": 1,
                    "maxItems": 1000
                  },
                  "schedule_type": {
                    "type": "string",
                    "description": "now requests launch immediately after creation. schedule saves scheduled work that the scheduler can launch.",
                    "enum": [
                      "now",
                      "schedule"
                    ],
                    "default": "now"
                  },
                  "scheduled_date": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "For schedule mode, use YYYY-MM-DD. A date and optional sending window control eligibility. No scheduled_at field or exact dispatch time is supported.",
                    "format": "date",
                    "default": null
                  },
                  "window_start_minutes": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "description": "Start minute after midnight; supply both ends. Zero means midnight.",
                    "minimum": 0,
                    "maximum": 1439,
                    "default": null
                  },
                  "window_end_minutes": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "description": "End minute after midnight; supply both ends. A lower end denotes an overnight window.",
                    "minimum": 0,
                    "maximum": 1439,
                    "default": null
                  },
                  "window_days": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string",
                      "description": "Weekday.",
                      "enum": [
                        "mon",
                        "tue",
                        "wed",
                        "thu",
                        "fri",
                        "sat",
                        "sun"
                      ]
                    },
                    "description": "Optional selected weekdays; duplicate values are collapsed and empty means unset.",
                    "default": null
                  },
                  "timezone": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Optional valid IANA campaign time zone. It does not replace a recipient’s location.",
                    "default": null
                  },
                  "source": {
                    "type": "string",
                    "description": "Origin label only; API clients should keep api.",
                    "enum": [
                      "api",
                      "dashboard"
                    ],
                    "default": "api"
                  },
                  "skip_invalid": {
                    "type": "boolean",
                    "description": "When true, omit invalid phone rows only. At least one valid row remains required; other validation failures still refuse.",
                    "default": false
                  },
                  "duplicate_policy": {
                    "type": "string",
                    "description": "warn retains duplicate rows and reports them; allow explicitly keeps them; reject refuses duplicates. warn is advisory and does not prevent automatic launch. No silent deduplication.",
                    "enum": [
                      "allow",
                      "warn",
                      "reject"
                    ],
                    "default": "warn"
                  },
                  "consent_confirmed": {
                    "type": "boolean",
                    "description": "Record confirmation for this campaign. Missing consent holds contact until recorded.",
                    "default": false
                  },
                  "allow_wider_hours": {
                    "type": "boolean",
                    "description": "Request wider hours with a recorded explanation. Recipient policy and other checks still apply.",
                    "default": false
                  },
                  "hours_confirmation": {
                    "type": "string",
                    "description": "Required when wider hours is true: trimmed explanation at least 20 characters; raw maximum 1,000.",
                    "minLength": 20,
                    "maxLength": 1000
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Nonblank default instructions used by every row without a prompt override. No separate maximum; the whole JSON request must be under 100 KB. This route does not read prompt_validation and does not check a 10-character minimum."
                  },
                  "reuse_campaign_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Replace an owned never-launched draft or scheduled voice campaign atomically. Launched campaigns are refused; this is not an idempotency key.",
                    "default": null
                  }
                },
                "required": [
                  "agent_id",
                  "from_number",
                  "prompt",
                  "recipients"
                ],
                "description": "",
                "additionalProperties": false
              },
              "example": {
                "agent_id": "agent_example",
                "from_number": "+12025550101",
                "prompt": "Confirm the appointment requested by the recipient.",
                "recipients": [
                  {
                    "phone": "+12025550101",
                    "variables": {
                      "name": "Example customer"
                    },
                    "country": "GB",
                    "timezone": "Europe/London"
                  }
                ],
                "schedule_type": "schedule",
                "scheduled_date": "2030-11-04",
                "duplicate_policy": "reject",
                "consent_confirmed": true
              }
            }
          }
        }
      }
    },
    "/calls/batch/{id}/launch": {
      "post": {
        "operationId": "launchBatchCampaign",
        "summary": "Launch a voice campaign",
        "description": "Request the first launch of an owned voice campaign. Ownership, readiness and launch state are checked before dispatch; each recipient still passes current contact checks. No request body is used. This can contact real recipients. A second launch is refused after a campaign has been claimed, including finished runs. A missing or foreign campaign is reported as 400 invalid_request.\n\nConsent, suppression, recipient-local windows and capacity remain normal contact gates. A manual launch is not permission to bypass them. The response counts enqueued jobs, not ringing or completed calls.",
        "tags": [
          "Voice campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Exact saved campaign_id owned by this account. This operation does not declare a route-level length or character validator."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string",
                      "description": "Campaign ID."
                    },
                    "status": {
                      "type": "string",
                      "description": "Running means queue admission, not completed calls.",
                      "const": "running"
                    },
                    "total_recipients": {
                      "type": "integer",
                      "description": "Count.",
                      "minimum": 0
                    },
                    "enqueued": {
                      "type": "integer",
                      "description": "Jobs accepted by the queue; not proof of dialing."
                    },
                    "failed_to_enqueue": {
                      "type": "integer",
                      "description": "Zero on a confirmed successful launch; uncertain enqueue returns an error."
                    },
                    "message": {
                      "type": "string",
                      "description": "Queue admission explanation."
                    }
                  },
                  "required": [
                    "campaign_id",
                    "status",
                    "total_recipients",
                    "enqueued",
                    "failed_to_enqueue",
                    "message"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "status": "running",
                  "total_recipients": 1,
                  "enqueued": 1,
                  "failed_to_enqueue": 0,
                  "message": "Jobs queued for final permission, local-hours and capacity checks; queued does not mean dialed"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "number_disabled: Outbound voice is disabled for this number.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "campaign_outcome_unknown: A campaign save or launch result is uncertain. server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "campaigns_paused: Campaign admission is temporarily paused.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/campaigns": {
      "get": {
        "operationId": "listCampaigns",
        "summary": "List voice campaigns",
        "description": "List this account’s voice campaigns, newest first. This bounded list has no offset or cursor. Sort order is created_at descending. There is no tie-break cursor, offset, total or full-history paging contract. Unknown query keys are ignored. Counts describe stored campaign state, not delivery guarantees.",
        "tags": [
          "Voice campaigns"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional exact status filter. Unknown values normally return no matches."
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Parsed as an integer; missing, invalid or nonpositive uses 50; capped at 200.",
              "default": 50,
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaigns": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "campaign_id": {
                            "type": "string",
                            "description": "Public campaign ID."
                          },
                          "agent_id": {
                            "type": "string",
                            "description": "Owning agent ID."
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved campaign label."
                          },
                          "from_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "International number with + and digits; no spaces.",
                            "pattern": "^\\+[1-9][0-9]{6,14}$"
                          },
                          "schedule_type": {
                            "type": "string",
                            "description": "Saved now or schedule mode."
                          },
                          "scheduled_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved scheduled date."
                          },
                          "window_start_minutes": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Configured start minute."
                          },
                          "window_end_minutes": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Configured end minute."
                          },
                          "window_days": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "items": {
                              "type": "string",
                              "description": "Weekday."
                            },
                            "description": ""
                          },
                          "timezone": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved campaign time zone."
                          },
                          "source": {
                            "type": "string",
                            "description": "Saved origin label."
                          },
                          "status": {
                            "type": "string",
                            "description": "Current state; for example scheduled, launching, running, done, failed or cancelled. Treat new states conservatively."
                          },
                          "total_count": {
                            "type": "integer",
                            "description": "Count.",
                            "minimum": 0
                          },
                          "started_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "completed_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "created_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "updated_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "allow_wider_hours": {
                            "type": "boolean",
                            "description": "True only with confirmation evidence for the current policy revision."
                          },
                          "prompt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Default voice instructions."
                          },
                          "done_count": {
                            "type": "integer",
                            "description": "Count.",
                            "minimum": 0
                          },
                          "failed_count": {
                            "type": "integer",
                            "description": "Count.",
                            "minimum": 0
                          },
                          "voicemail_count": {
                            "type": "integer",
                            "description": "Count.",
                            "minimum": 0
                          }
                        },
                        "required": [
                          "campaign_id",
                          "agent_id",
                          "name",
                          "from_number",
                          "schedule_type",
                          "scheduled_date",
                          "window_start_minutes",
                          "window_end_minutes",
                          "window_days",
                          "timezone",
                          "source",
                          "status",
                          "total_count",
                          "started_at",
                          "completed_at",
                          "created_at",
                          "updated_at",
                          "allow_wider_hours",
                          "prompt",
                          "done_count",
                          "failed_count",
                          "voicemail_count"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": ""
                    }
                  },
                  "required": [
                    "campaigns"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaigns": []
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/sms": {
      "post": {
        "tags": [
          "SMS"
        ],
        "summary": "Send an SMS",
        "description": "Send one SMS using an explicit sender owned by the account and assigned to the requested agent. A 201 sent response means the send was accepted; it does not confirm delivery to the recipient. The endpoint has no dry-run mode. Only send to an authorised recipient. Do not infer a sender from agent settings, and do not send API credentials to a browser. The response can gain receipt fields when that feature is enabled; older successful responses contain only status, to and from.\n\nThe sent text appears in that number’s SMS inbox thread and does not pause automatic replies. An accepted message can still return 201 if later local history persistence fails. A receipt-path failure can include outcome, work_id, message_id and safe_to_retry both alongside the error and inside details. Do not infer not-sent from a generic 500 response. Contact-hours refusals use error.code outside_hours or needs_timezone (409), or contact_policy_unavailable (503). Details include outcome:not_sent, sent:false and charged:false. Advisory messages can instead start “Outside calling hours” or “Weekend where they are” and contain the next local window. refused_before_dispatch is a dispatch outcome marker, not an HTTP status or a replacement error.code. An unknown outcome can still mean something was sent.",
        "operationId": "sendSms",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "Accepted send state; not a delivery receipt.",
                      "const": "sent"
                    },
                    "to": {
                      "type": "string",
                      "description": "Recipient."
                    },
                    "from": {
                      "type": "string",
                      "description": "Sender."
                    },
                    "message_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Optional accepted message identity when account receipts are enabled."
                    },
                    "work_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Optional work receipt identity."
                    },
                    "persistence": {
                      "type": "string",
                      "description": "Optional persistence state returned by the receipt path."
                    },
                    "safe_to_retry": {
                      "type": "boolean",
                      "description": "False when supplied; do not resend an accepted message.",
                      "const": false
                    }
                  },
                  "required": [
                    "status",
                    "to",
                    "from"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "status": "sent",
                  "to": "+12025550101",
                  "from": "+12025550100"
                }
              }
            }
          },
          "400": {
            "description": "missing_field: An agent, recipient, message or sender is missing. Provide all four required fields. invalid_request: The sender, assignment, connection or recipient is not permitted. Read the refusal; use the correct owned sender and respect suppression.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: The agent could not be found for this account. Use an owned agent ID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "auto_topup_unsupported: The current account funding configuration is not supported for this send. Resolve the account configuration before sending. needs_timezone: The recipient location does not establish a usable time zone. Supply the recipient time zone after checking it. invalid_recipient_timezone: The recipient time zone is invalid. Use a valid IANA time zone. invalid_recipient_country: The recipient country is invalid. Use a valid two-letter country code. outside_hours: The recipient is outside permitted contact hours. Wait for an allowed window; do not bypass the policy. not_due_local: The recipient is not due for contact in the current local window. Follow the returned contact-hours guidance. country_policy_review: The recipient country requires policy review. Resolve that review before contacting the recipient. holiday_data_unavailable: Holiday checks could not confirm an allowed window. Wait for a confirmed policy result. public_holiday: The recipient-local date is a restricted holiday. Use the next permitted contact window. do_not_contact: This recipient is on your do-not-contact list. The message was not sent. Respect the opt-out; do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "examples": {
                  "needs_timezone": {
                    "summary": "needs_timezone (message may include local-window advice)",
                    "value": {
                      "error": {
                        "type": "conflict",
                        "code": "needs_timezone",
                        "message": "Time zone unknown - add their time zone or country. Nothing was sent or charged for this attempt.",
                        "doc_url": "https://docs.nixflex.com/errors/needs_timezone",
                        "details": {
                          "outcome": "not_sent",
                          "sent": false,
                          "charged": false,
                          "safe_to_retry": false
                        }
                      }
                    }
                  },
                  "outside_hours": {
                    "summary": "outside_hours (message may include local-window advice)",
                    "value": {
                      "error": {
                        "type": "conflict",
                        "code": "outside_hours",
                        "message": "This recipient is outside the permitted local contact hours. Nothing was sent or charged for this attempt.",
                        "doc_url": "https://docs.nixflex.com/errors/outside_hours",
                        "details": {
                          "outcome": "not_sent",
                          "sent": false,
                          "charged": false,
                          "safe_to_retry": false
                        }
                      }
                    }
                  },
                  "do_not_contact": {
                    "value": {
                      "error": {
                        "type": "conflict",
                        "code": "do_not_contact",
                        "message": "This recipient is on your do-not-contact list. The message was not sent.",
                        "doc_url": "https://docs.nixflex.com/errors/do_not_contact",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "sms_outcome_unknown: The send outcome was not confirmed. Check the receipt/history before any deliberate new send; do not auto-retry. server_error: The legacy send path failed or could not confirm a result. Treat the result as uncertain until reconciled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "contact_policy_unavailable: Contact policy could not be checked. Wait for recovery; do not automatically retry a send. dispatch_safety_unavailable: Dispatch safety could not be confirmed. Reconcile any existing receipt before deciding on a new request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "examples": {
                  "contact_policy_unavailable": {
                    "summary": "contact_policy_unavailable (message may include local-window advice)",
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "contact_policy_unavailable",
                        "message": "Contact hours could not be checked. Try again later. Nothing was sent or charged for this attempt.",
                        "doc_url": "https://docs.nixflex.com/errors/contact_policy_unavailable",
                        "details": {
                          "outcome": "not_sent",
                          "sent": false,
                          "charged": false,
                          "safe_to_retry": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent_id": {
                    "type": "string",
                    "description": "Owned agent ID.",
                    "minLength": 1
                  },
                  "from_number": {
                    "type": "string",
                    "description": "Explicit owned, settled sender assigned to this agent. There is no agent-number fallback.",
                    "minLength": 1
                  },
                  "to": {
                    "type": "string",
                    "description": "Recipient number. This field is to, not to_number.",
                    "minLength": 1
                  },
                  "message": {
                    "type": "string",
                    "description": "Nonempty text. This route declares no fixed character cap; encoding, segmentation and connection limits still apply.",
                    "minLength": 1
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "reply_context": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Optional instructions for a later reply context."
                      }
                    },
                    "description": "Optional JSON context saved with the accepted outbound message.",
                    "additionalProperties": true
                  },
                  "recipient_timezone": {
                    "type": "string",
                    "description": "Optional recipient IANA time zone for contact checks."
                  },
                  "recipient_country": {
                    "type": "string",
                    "description": "Optional two-letter recipient country code."
                  }
                },
                "required": [
                  "agent_id",
                  "from_number",
                  "to",
                  "message"
                ],
                "description": "",
                "additionalProperties": false
              },
              "example": {
                "agent_id": "agent_example",
                "from_number": "+12025550100",
                "to": "+12025550101",
                "message": "Your requested appointment reminder."
              }
            }
          }
        }
      }
    },
    "/sms/campaigns": {
      "post": {
        "operationId": "createSmsCampaign",
        "summary": "Create an SMS campaign",
        "description": "Create an SMS campaign and its recipient rows. The default now mode immediately requests launch; schedule mode saves scheduled work that can run automatically. There is no public draft-only flag. ### Scheduling, consent and duplicate rows\n\nThe scheduler and final contact checks use recipient-local eligibility, consent, suppression and capacity. A campaign time zone is not a substitute for an unknown recipient location. Preview contact hours before saving; a preview is advisory. Wider hours require the recorded explanation and remain subject to policy.\n\nChoose duplicate_policy deliberately. reject refuses repeated accepted numbers, allow keeps every row, and warn reports duplicates but still allows this route to request launch. The duplicate_choice_required response flag is advisory. It does not create a safe draft or block sending.\n\nThe scheduled example can contact its recipients when due. Use an approved destination and consent; the date is illustrative. No public draft-only flag is accepted. SMS creation generates a new campaign ID even if reuse_campaign_id is sent. Create a new campaign to run it again.\n\nJSON request size and database constraints can limit a request before the maximum accepted-recipient count. No additional text length limit is declared for the prompt or message template on this route.",
        "tags": [
          "SMS campaigns"
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "campaign_id": {
                          "type": "string",
                          "description": "Saved campaign ID."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Original input row count."
                        },
                        "total_recipients": {
                          "type": "integer",
                          "description": "Accepted saved rows."
                        },
                        "valid_count": {
                          "type": "integer",
                          "description": "Accepted recipient rows."
                        },
                        "invalid_count": {
                          "type": "integer",
                          "description": "Rejected phone rows."
                        },
                        "invalid": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "phone": {
                                "description": "Original rejected phone input, which may be null or a non-string value."
                              },
                              "reason": {
                                "type": "string",
                                "description": "Why this row failed."
                              },
                              "row_index": {
                                "type": "integer",
                                "description": "Zero-based original row.",
                                "minimum": 0
                              },
                              "variables": {
                                "type": "object",
                                "properties": {},
                                "description": "Original variables when present.",
                                "additionalProperties": true
                              }
                            },
                            "required": [
                              "phone",
                              "reason",
                              "row_index"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "description": ""
                        },
                        "duplicates": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "phone": {
                                "type": "string",
                                "description": "International number with + and digits; no spaces.",
                                "pattern": "^\\+[1-9][0-9]{6,14}$"
                              },
                              "row_indices": {
                                "type": "array",
                                "items": {
                                  "type": "integer",
                                  "description": "Zero-based original input row.",
                                  "minimum": 0
                                },
                                "description": ""
                              },
                              "different_content": {
                                "type": "boolean",
                                "description": "Duplicate rows have different variables or prompts."
                              }
                            },
                            "required": [
                              "phone",
                              "row_indices",
                              "different_content"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "description": "Repeated accepted destinations."
                        },
                        "duplicate_policy": {
                          "type": "string",
                          "description": "Applied duplicate decision.",
                          "enum": [
                            "allow",
                            "warn",
                            "reject"
                          ]
                        },
                        "duplicate_choice_required": {
                          "type": "boolean",
                          "description": "Advisory flag for repeated rows under warn; it is not a server-side launch lock."
                        },
                        "status": {
                          "type": "string",
                          "description": "Saved campaign state."
                        }
                      },
                      "required": [
                        "campaign_id",
                        "total",
                        "total_recipients",
                        "valid_count",
                        "invalid_count",
                        "invalid",
                        "status",
                        "duplicates",
                        "duplicate_policy",
                        "duplicate_choice_required"
                      ],
                      "description": "",
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "campaign_id": {
                          "type": "string",
                          "description": "Campaign ID."
                        },
                        "status": {
                          "type": "string",
                          "description": "running while held; otherwise done or failed."
                        },
                        "sent": {
                          "type": "integer",
                          "description": "Accepted sends; not delivery proof."
                        },
                        "failed": {
                          "type": "integer",
                          "description": "Known failures, distinct from accepted sends."
                        },
                        "total_segments": {
                          "type": "integer",
                          "description": "Segment count for this run."
                        },
                        "held": {
                          "type": "integer",
                          "description": "Held recipients when present."
                        },
                        "reason": {
                          "type": "string",
                          "description": "Hold reason when present."
                        },
                        "safe_to_retry": {
                          "type": "boolean",
                          "description": "False when held or outcome requires reconciliation."
                        },
                        "stopped": {
                          "type": "boolean",
                          "description": "Present when number changes stop a legacy run."
                        },
                        "stop_reason": {
                          "type": "string",
                          "description": "Why sending stopped."
                        },
                        "not_sent": {
                          "type": "integer",
                          "description": "Remaining unattempted recipients when known."
                        },
                        "valid_count": {
                          "type": "integer",
                          "description": "Accepted recipient rows."
                        },
                        "invalid_count": {
                          "type": "integer",
                          "description": "Rejected phone rows."
                        },
                        "invalid": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "phone": {
                                "description": "Original rejected phone input, which may be null or a non-string value."
                              },
                              "reason": {
                                "type": "string",
                                "description": "Why this row failed."
                              },
                              "row_index": {
                                "type": "integer",
                                "description": "Zero-based original row.",
                                "minimum": 0
                              },
                              "variables": {
                                "type": "object",
                                "properties": {},
                                "description": "Original variables when present.",
                                "additionalProperties": true
                              }
                            },
                            "required": [
                              "phone",
                              "reason",
                              "row_index"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "description": ""
                        },
                        "duplicates": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "phone": {
                                "type": "string",
                                "description": "International number with + and digits; no spaces.",
                                "pattern": "^\\+[1-9][0-9]{6,14}$"
                              },
                              "row_indices": {
                                "type": "array",
                                "items": {
                                  "type": "integer",
                                  "description": "Zero-based original input row.",
                                  "minimum": 0
                                },
                                "description": ""
                              },
                              "different_content": {
                                "type": "boolean",
                                "description": "Duplicate rows have different variables or prompts."
                              }
                            },
                            "required": [
                              "phone",
                              "row_indices",
                              "different_content"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "description": "Repeated accepted destinations."
                        },
                        "duplicate_policy": {
                          "type": "string",
                          "description": "Applied duplicate decision.",
                          "enum": [
                            "allow",
                            "warn",
                            "reject"
                          ]
                        },
                        "duplicate_choice_required": {
                          "type": "boolean",
                          "description": "Advisory flag for repeated rows under warn; it is not a server-side launch lock."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Original input row count."
                        }
                      },
                      "required": [
                        "campaign_id",
                        "status",
                        "sent",
                        "failed",
                        "total_segments"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  ],
                  "description": "Scheduled creation or immediate launch result."
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "total": 1,
                  "total_recipients": 1,
                  "valid_count": 1,
                  "invalid_count": 0,
                  "invalid": [],
                  "status": "scheduled",
                  "duplicates": [],
                  "duplicate_policy": "reject",
                  "duplicate_choice_required": false
                }
              }
            }
          },
          "400": {
            "description": "campaign_creation_failed: Required settings, ownership, template values, duplicate policy or recipient metadata failed validation. invalid_phone_format: Phone validation failed or no valid recipients remain. campaign_launch_failed: Creation succeeded but immediate launch was refused. invalid_json: Invalid JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "account_inactive: Account sending is disabled. number_changed: The sending number changed. do_not_contact: The current recipient is suppressed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request exceeds the JSON body limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "campaign_outcome_unknown: A campaign save or launch result is uncertain. server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "campaigns_paused: Campaign admission is temporarily paused. dispatch_safety_unavailable: The current recipient was refused before sending because its safety record was unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent_id": {
                    "type": "string",
                    "description": "Active agent owned by this account."
                  },
                  "from_number": {
                    "type": "string",
                    "description": "International number with + and digits; no spaces.",
                    "pattern": "^\\+[1-9][0-9]{6,14}$"
                  },
                  "name": {
                    "type": "string",
                    "description": "Campaign label. Empty or omitted uses the channel-specific Untitled campaign label."
                  },
                  "recipients": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "phone": {
                          "type": "string",
                          "description": "Trimmed E.164 string, 8–15 digits after +; country numbering-plan validation also applies.",
                          "pattern": "^\\+[1-9][0-9]{7,14}$"
                        },
                        "variables": {
                          "type": "object",
                          "properties": {},
                          "description": "Per-recipient template values.",
                          "additionalProperties": true,
                          "default": {}
                        },
                        "country": {
                          "type": "string",
                          "description": "Uppercase supported two-letter country. Omitted uses conservative number inference.",
                          "minLength": 2,
                          "maxLength": 2
                        },
                        "timezone": {
                          "type": "string",
                          "description": "Explicit recipient IANA Area/City zone; preferred over number inference. Unknown location is held, never replaced by the campaign clock.",
                          "maxLength": 80
                        }
                      },
                      "required": [
                        "phone"
                      ],
                      "description": "",
                      "additionalProperties": false
                    },
                    "description": "At least one accepted recipient; send at most 1,000 recipients per campaign (the whole request must stay under 100 KB). For a bigger list, create several campaigns.",
                    "minItems": 1,
                    "maxItems": 1000
                  },
                  "schedule_type": {
                    "type": "string",
                    "description": "now requests launch immediately after creation. schedule saves scheduled work that the scheduler can launch.",
                    "enum": [
                      "now",
                      "schedule"
                    ],
                    "default": "now"
                  },
                  "scheduled_date": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "For schedule mode, use YYYY-MM-DD. A date and optional sending window control eligibility. No scheduled_at field or exact dispatch time is supported.",
                    "format": "date",
                    "default": null
                  },
                  "window_start_minutes": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "description": "Start minute after midnight; supply both ends. Zero means midnight.",
                    "minimum": 0,
                    "maximum": 1439,
                    "default": null
                  },
                  "window_end_minutes": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "description": "End minute after midnight; supply both ends. A lower end denotes an overnight window.",
                    "minimum": 0,
                    "maximum": 1439,
                    "default": null
                  },
                  "window_days": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string",
                      "description": "Weekday.",
                      "enum": [
                        "mon",
                        "tue",
                        "wed",
                        "thu",
                        "fri",
                        "sat",
                        "sun"
                      ]
                    },
                    "description": "Optional selected weekdays; duplicate values are collapsed and empty means unset.",
                    "default": null
                  },
                  "timezone": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Optional valid IANA campaign time zone. It does not replace a recipient’s location.",
                    "default": null
                  },
                  "source": {
                    "type": "string",
                    "description": "Origin label only; API clients should keep api.",
                    "enum": [
                      "api",
                      "dashboard"
                    ],
                    "default": "api"
                  },
                  "skip_invalid": {
                    "type": "boolean",
                    "description": "When true, omit invalid phone rows only. At least one valid row remains required; other validation failures still refuse.",
                    "default": false
                  },
                  "duplicate_policy": {
                    "type": "string",
                    "description": "warn retains duplicate rows and reports them; allow explicitly keeps them; reject refuses duplicates. warn is advisory and does not prevent automatic launch. No silent deduplication.",
                    "enum": [
                      "allow",
                      "warn",
                      "reject"
                    ],
                    "default": "warn"
                  },
                  "consent_confirmed": {
                    "type": "boolean",
                    "description": "Record confirmation for this campaign. Missing consent holds contact until recorded.",
                    "default": false
                  },
                  "allow_wider_hours": {
                    "type": "boolean",
                    "description": "Request wider hours with a recorded explanation. Recipient policy and other checks still apply.",
                    "default": false
                  },
                  "hours_confirmation": {
                    "type": "string",
                    "description": "Required when wider hours is true: trimmed explanation at least 20 characters; raw maximum 1,000.",
                    "minLength": 20,
                    "maxLength": 1000
                  },
                  "message_template": {
                    "type": "string",
                    "description": "Nonblank text template. Each placeholder such as `{{name}}` must have a value in every recipient’s variables."
                  },
                  "reply_context_prompt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Instructions for replies associated with this campaign.",
                    "default": null
                  },
                  "reply_window_hours": {
                    "type": "integer",
                    "description": "Hours for campaign reply association; positive integer. Omitted or zero uses 168.",
                    "minimum": 1,
                    "default": 168
                  }
                },
                "required": [
                  "agent_id",
                  "from_number",
                  "message_template",
                  "recipients"
                ],
                "description": "",
                "additionalProperties": false
              },
              "example": {
                "agent_id": "agent_example",
                "from_number": "+12025550101",
                "message_template": "Hello {{name}}, your requested appointment reminder.",
                "recipients": [
                  {
                    "phone": "+12025550101",
                    "variables": {
                      "name": "Example customer"
                    },
                    "country": "GB",
                    "timezone": "Europe/London"
                  }
                ],
                "schedule_type": "schedule",
                "scheduled_date": "2030-11-04",
                "duplicate_policy": "reject",
                "consent_confirmed": true
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listSmsCampaigns",
        "summary": "List SMS campaigns",
        "description": "List this account’s SMS campaigns, newest first. Delivery totals cover all campaign recipients, not just the returned page. Sort order is created_at descending then row id descending. Send next_cursor back as before and keep the same status filter. Continue until an empty page returns null; a nonnull cursor does not confirm that another row exists. A malformed before cursor currently returns 500 server_error.\n\nSent and failed totals are distinct measures and may overlap after a later delivery failure. Do not add them to infer a unique recipient total. Segments are estimates.",
        "tags": [
          "SMS campaigns"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional exact status filter. Unknown values normally return no matches."
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Positive integer; omitted or invalid uses 1,000; capped at 1,000.",
              "default": 1000,
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Opaque next_cursor from the previous response; preserve unchanged."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaigns": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "campaign_id": {
                            "type": "string",
                            "description": "Public campaign ID."
                          },
                          "agent_id": {
                            "type": "string",
                            "description": "Owning agent ID."
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved campaign label."
                          },
                          "from_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "International number with + and digits; no spaces.",
                            "pattern": "^\\+[1-9][0-9]{6,14}$"
                          },
                          "schedule_type": {
                            "type": "string",
                            "description": "Saved now or schedule mode."
                          },
                          "scheduled_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved scheduled date."
                          },
                          "window_start_minutes": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Configured start minute."
                          },
                          "window_end_minutes": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Configured end minute."
                          },
                          "window_days": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "items": {
                              "type": "string",
                              "description": "Weekday."
                            },
                            "description": ""
                          },
                          "timezone": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved campaign time zone."
                          },
                          "source": {
                            "type": "string",
                            "description": "Saved origin label."
                          },
                          "status": {
                            "type": "string",
                            "description": "Current state; for example scheduled, launching, running, done, failed or cancelled. Treat new states conservatively."
                          },
                          "total_count": {
                            "type": "integer",
                            "description": "Count.",
                            "minimum": 0
                          },
                          "started_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "completed_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "created_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "updated_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "allow_wider_hours": {
                            "type": "boolean",
                            "description": "True only with confirmation evidence for the current policy revision."
                          },
                          "id": {
                            "type": "string",
                            "description": "Row ID of this campaign record (UUID); the opaque list cursor includes it. Use `campaign_id` in requests.",
                            "format": "uuid"
                          },
                          "api_key_id": {
                            "type": "string",
                            "description": "Owning account ID, not its secret."
                          },
                          "message_template": {
                            "type": "string",
                            "description": "Saved text template."
                          },
                          "reply_context_prompt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved reply instructions."
                          },
                          "reply_window_hours": {
                            "type": "integer",
                            "description": "Reply association window in hours."
                          },
                          "is_active": {
                            "type": "boolean",
                            "description": "Reply behaviour enabled flag; not a dispatch cancellation control."
                          },
                          "claimed_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "sent_count": {
                            "type": "integer",
                            "description": "Rows accepted for sending, including delivered or replied rows. Can overlap with later failures."
                          },
                          "delivered_count": {
                            "type": "integer",
                            "description": "Delivered or replied rows."
                          },
                          "failed_count": {
                            "type": "integer",
                            "description": "Failed or undelivered rows."
                          },
                          "reply_count": {
                            "type": "integer",
                            "description": "Recipients marked replied."
                          },
                          "total_segments": {
                            "type": "integer",
                            "description": "Estimated sum of recipient segments."
                          },
                          "pending_count": {
                            "type": "integer",
                            "description": "Rows pending or queued."
                          },
                          "segments_estimated": {
                            "type": "boolean",
                            "description": "Reported segments are estimates.",
                            "const": true
                          }
                        },
                        "required": [
                          "campaign_id",
                          "agent_id",
                          "name",
                          "from_number",
                          "schedule_type",
                          "scheduled_date",
                          "window_start_minutes",
                          "window_end_minutes",
                          "window_days",
                          "timezone",
                          "source",
                          "status",
                          "total_count",
                          "started_at",
                          "completed_at",
                          "created_at",
                          "updated_at",
                          "allow_wider_hours",
                          "id",
                          "api_key_id",
                          "message_template",
                          "reply_context_prompt",
                          "reply_window_hours",
                          "is_active",
                          "claimed_at",
                          "sent_count",
                          "delivered_count",
                          "failed_count",
                          "reply_count",
                          "total_segments",
                          "pending_count",
                          "segments_estimated"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": ""
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Opaque next page cursor. Nonempty pages produce a cursor even when shorter than the limit."
                    }
                  },
                  "required": [
                    "campaigns",
                    "next_cursor"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaigns": [],
                  "next_cursor": null
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/sms/campaigns/{id}": {
      "get": {
        "operationId": "getSmsCampaign",
        "summary": "Get an SMS campaign",
        "description": "Read one owned SMS campaign with recipient and message history. The campaign counters cover the whole campaign; the two history lists have independent cursors. Provide limit to request bounded pages. Each list is ordered by id ascending and advances independently. Keep an exhausted list finished in your client; omitting its cursor restarts that list. A full page can return a cursor even at the end, so another empty read may be needed.\n\nWithout limit or cursors, the server collects history in 200-row chunks, with a 100,000-row ceiling per list, then sorts by created_at ascending with missing timestamps last. This compatibility mode is not a snapshot. Invalid limits or malformed UUID cursors currently return 500 server_error; a missing campaign or failed initial lookup returns 404 not_found. Retention can remove content between reads.",
        "tags": [
          "SMS campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Exact saved campaign_id owned by this account. This operation does not declare a route-level length or character validator."
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Supplying this enables paging; page default 200, maximum 500.",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "recipient_cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Last recipient UUID from pagination.recipient_cursor.",
              "format": "uuid"
            }
          },
          {
            "name": "message_cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Last message UUID from pagination.message_cursor.",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign": {
                      "type": "object",
                      "properties": {
                        "campaign_id": {
                          "type": "string",
                          "description": "Public campaign ID."
                        },
                        "agent_id": {
                          "type": "string",
                          "description": "Owning agent ID."
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved campaign label."
                        },
                        "from_number": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "International number with + and digits; no spaces.",
                          "pattern": "^\\+[1-9][0-9]{6,14}$"
                        },
                        "schedule_type": {
                          "type": "string",
                          "description": "Saved now or schedule mode."
                        },
                        "scheduled_date": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved scheduled date."
                        },
                        "window_start_minutes": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Configured start minute."
                        },
                        "window_end_minutes": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Configured end minute."
                        },
                        "window_days": {
                          "type": [
                            "array",
                            "null"
                          ],
                          "items": {
                            "type": "string",
                            "description": "Weekday."
                          },
                          "description": ""
                        },
                        "timezone": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved campaign time zone."
                        },
                        "source": {
                          "type": "string",
                          "description": "Saved origin label."
                        },
                        "status": {
                          "type": "string",
                          "description": "Current state; for example scheduled, launching, running, done, failed or cancelled. Treat new states conservatively."
                        },
                        "total_count": {
                          "type": "integer",
                          "description": "Count.",
                          "minimum": 0
                        },
                        "started_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved timestamp, or null.",
                          "format": "date-time"
                        },
                        "completed_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved timestamp, or null.",
                          "format": "date-time"
                        },
                        "created_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved timestamp, or null.",
                          "format": "date-time"
                        },
                        "updated_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved timestamp, or null.",
                          "format": "date-time"
                        },
                        "allow_wider_hours": {
                          "type": "boolean",
                          "description": "True only with confirmation evidence for the current policy revision."
                        },
                        "id": {
                          "type": "string",
                          "description": "Row ID of this campaign record (UUID); the opaque list cursor includes it. Use `campaign_id` in requests.",
                          "format": "uuid"
                        },
                        "api_key_id": {
                          "type": "string",
                          "description": "Owning account ID, not its secret."
                        },
                        "message_template": {
                          "type": "string",
                          "description": "Saved text template."
                        },
                        "reply_context_prompt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved reply instructions."
                        },
                        "reply_window_hours": {
                          "type": "integer",
                          "description": "Reply association window in hours."
                        },
                        "is_active": {
                          "type": "boolean",
                          "description": "Reply behaviour enabled flag; not a dispatch cancellation control."
                        },
                        "claimed_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved timestamp, or null.",
                          "format": "date-time"
                        },
                        "sent_count": {
                          "type": "integer",
                          "description": "Rows accepted for sending, including delivered or replied rows. Can overlap with later failures."
                        },
                        "delivered_count": {
                          "type": "integer",
                          "description": "Delivered or replied rows."
                        },
                        "failed_count": {
                          "type": "integer",
                          "description": "Failed or undelivered rows."
                        },
                        "reply_count": {
                          "type": "integer",
                          "description": "Recipients marked replied."
                        },
                        "total_segments": {
                          "type": "integer",
                          "description": "Estimated sum of recipient segments."
                        },
                        "pending_count": {
                          "type": "integer",
                          "description": "Rows pending or queued."
                        },
                        "segments_estimated": {
                          "type": "boolean",
                          "description": "Reported segments are estimates.",
                          "const": true
                        }
                      },
                      "required": [
                        "campaign_id",
                        "agent_id",
                        "name",
                        "from_number",
                        "schedule_type",
                        "scheduled_date",
                        "window_start_minutes",
                        "window_end_minutes",
                        "window_days",
                        "timezone",
                        "source",
                        "status",
                        "total_count",
                        "started_at",
                        "completed_at",
                        "created_at",
                        "updated_at",
                        "allow_wider_hours",
                        "id",
                        "api_key_id",
                        "message_template",
                        "reply_context_prompt",
                        "reply_window_hours",
                        "is_active",
                        "claimed_at",
                        "sent_count",
                        "delivered_count",
                        "failed_count",
                        "reply_count",
                        "total_segments",
                        "pending_count",
                        "segments_estimated"
                      ],
                      "description": "",
                      "additionalProperties": false
                    },
                    "recipients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Recipient row ID.",
                            "format": "uuid"
                          },
                          "campaign_id": {
                            "type": "string",
                            "description": "Campaign ID."
                          },
                          "api_key_id": {
                            "type": "string",
                            "description": "Owner account ID."
                          },
                          "phone_number": {
                            "type": "string",
                            "description": "International number with + and digits; no spaces.",
                            "pattern": "^\\+[1-9][0-9]{6,14}$"
                          },
                          "variables": {
                            "type": "object",
                            "properties": {},
                            "description": "Saved template variables.",
                            "additionalProperties": true
                          },
                          "rendered_message": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Rendered outgoing message."
                          },
                          "status": {
                            "type": "string",
                            "description": "Recipient state."
                          },
                          "segments_count": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Estimated segment count."
                          },
                          "sent_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "delivered_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "replied_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "error_message": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved failure explanation."
                          },
                          "created_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "updated_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "timezone": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Recipient time zone."
                          },
                          "country": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Recipient country."
                          },
                          "timezone_source": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Location evidence source."
                          },
                          "hold_reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Current contact hold."
                          },
                          "next_eligible_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "id",
                          "campaign_id",
                          "api_key_id",
                          "phone_number",
                          "variables",
                          "rendered_message",
                          "status",
                          "segments_count",
                          "sent_at",
                          "delivered_at",
                          "replied_at",
                          "error_message",
                          "created_at",
                          "updated_at",
                          "timezone",
                          "country",
                          "timezone_source",
                          "hold_reason",
                          "next_eligible_at"
                        ],
                        "description": "Recipient data; additional compatibility fields can be returned.",
                        "additionalProperties": true
                      },
                      "description": ""
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Message row ID.",
                            "format": "uuid"
                          },
                          "agent_id": {
                            "type": "string",
                            "description": "Agent ID."
                          },
                          "api_key_id": {
                            "type": "string",
                            "description": "Owner account ID."
                          },
                          "phone_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "International number with + and digits; no spaces.",
                            "pattern": "^\\+[1-9][0-9]{6,14}$"
                          },
                          "from_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "International number with + and digits; no spaces.",
                            "pattern": "^\\+[1-9][0-9]{6,14}$"
                          },
                          "to_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "International number with + and digits; no spaces.",
                            "pattern": "^\\+[1-9][0-9]{6,14}$"
                          },
                          "direction": {
                            "type": "string",
                            "description": "Message direction."
                          },
                          "message": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Message text."
                          },
                          "campaign_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Associated campaign ID."
                          },
                          "segments_count": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Estimated segments."
                          },
                          "sent_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "delivered_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "created_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "context_type": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Reply context type."
                          },
                          "context_prompt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Reply instructions."
                          },
                          "context_data": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {},
                            "description": "Associated context.",
                            "additionalProperties": true
                          },
                          "linked_call_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Linked call if present."
                          },
                          "delivery_status": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved delivery status."
                          },
                          "reply_to_sms_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Linked original message ID."
                          }
                        },
                        "required": [
                          "id",
                          "agent_id",
                          "api_key_id",
                          "phone_number",
                          "from_number",
                          "to_number",
                          "direction",
                          "message",
                          "campaign_id",
                          "segments_count",
                          "sent_at",
                          "delivered_at",
                          "created_at",
                          "context_type",
                          "context_prompt",
                          "context_data",
                          "linked_call_id",
                          "delivery_status",
                          "reply_to_sms_id"
                        ],
                        "description": "Message data; additional compatibility fields can be returned.",
                        "additionalProperties": true
                      },
                      "description": ""
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "recipient_cursor": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Next recipient cursor."
                        },
                        "message_cursor": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Next message cursor."
                        },
                        "limit": {
                          "type": "integer",
                          "description": "Effective per-list page size."
                        },
                        "paged": {
                          "type": "boolean",
                          "description": "Whether explicit pagination was requested."
                        }
                      },
                      "required": [
                        "recipient_cursor",
                        "message_cursor",
                        "limit",
                        "paged"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "campaign",
                    "recipients",
                    "messages",
                    "pagination"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaign": {
                    "campaign_id": "campaign_example",
                    "agent_id": "agent_example",
                    "name": "Example SMS campaign",
                    "from_number": "+12025550101",
                    "schedule_type": "schedule",
                    "scheduled_date": "2030-11-04",
                    "window_start_minutes": null,
                    "window_end_minutes": null,
                    "window_days": null,
                    "timezone": null,
                    "source": "api",
                    "status": "scheduled",
                    "total_count": 1,
                    "started_at": null,
                    "completed_at": null,
                    "created_at": "2026-11-01T12:00:00Z",
                    "updated_at": "2026-11-01T12:00:00Z",
                    "allow_wider_hours": false,
                    "id": "00000000-0000-4000-8000-000000000001",
                    "api_key_id": "nxf_example",
                    "message_template": "Your requested reminder.",
                    "reply_context_prompt": null,
                    "reply_window_hours": 168,
                    "is_active": true,
                    "claimed_at": null,
                    "sent_count": 0,
                    "delivered_count": 0,
                    "failed_count": 0,
                    "reply_count": 0,
                    "total_segments": 0,
                    "pending_count": 1,
                    "segments_estimated": true
                  },
                  "recipients": [],
                  "messages": [],
                  "pagination": {
                    "recipient_cursor": null,
                    "message_cursor": null,
                    "limit": 1,
                    "paged": true
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching object belongs to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateSmsCampaign",
        "summary": "Update SMS reply settings",
        "description": "Update reply behaviour for one owned SMS campaign. This operation does not edit its recipients, schedule or message template, and it is not a cancellation control. The response is the campaign object directly, with no campaign wrapper. It contains saved counters, rather than the recomputed totals returned by list/detail. This route currently has no strict type/length validation before the database; empty updates, missing campaigns and database failures may return 500 server_error. Read detail after an uncertain save.",
        "tags": [
          "SMS campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Exact saved campaign_id owned by this account. This operation does not declare a route-level length or character validator."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string",
                      "description": "Public campaign ID."
                    },
                    "agent_id": {
                      "type": "string",
                      "description": "Owning agent ID."
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved campaign label."
                    },
                    "from_number": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "International number with + and digits; no spaces.",
                      "pattern": "^\\+[1-9][0-9]{6,14}$"
                    },
                    "schedule_type": {
                      "type": "string",
                      "description": "Saved now or schedule mode."
                    },
                    "scheduled_date": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved scheduled date."
                    },
                    "window_start_minutes": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Configured start minute."
                    },
                    "window_end_minutes": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Configured end minute."
                    },
                    "window_days": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string",
                        "description": "Weekday."
                      },
                      "description": ""
                    },
                    "timezone": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved campaign time zone."
                    },
                    "source": {
                      "type": "string",
                      "description": "Saved origin label."
                    },
                    "status": {
                      "type": "string",
                      "description": "Current state; for example scheduled, launching, running, done, failed or cancelled. Treat new states conservatively."
                    },
                    "total_count": {
                      "type": "integer",
                      "description": "Count.",
                      "minimum": 0
                    },
                    "started_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved timestamp, or null.",
                      "format": "date-time"
                    },
                    "completed_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved timestamp, or null.",
                      "format": "date-time"
                    },
                    "created_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved timestamp, or null.",
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved timestamp, or null.",
                      "format": "date-time"
                    },
                    "allow_wider_hours": {
                      "type": "boolean",
                      "description": "True only with confirmation evidence for the current policy revision."
                    },
                    "id": {
                      "type": "string",
                      "description": "Row ID of this campaign record (UUID); the opaque list cursor includes it. Use `campaign_id` in requests.",
                      "format": "uuid"
                    },
                    "api_key_id": {
                      "type": "string",
                      "description": "Owning account ID, not its secret."
                    },
                    "message_template": {
                      "type": "string",
                      "description": "Saved text template."
                    },
                    "reply_context_prompt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved reply instructions."
                    },
                    "reply_window_hours": {
                      "type": "integer",
                      "description": "Reply association window in hours."
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Reply behaviour enabled flag; not a dispatch cancellation control."
                    },
                    "claimed_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved timestamp, or null.",
                      "format": "date-time"
                    },
                    "sent_count": {
                      "type": "integer",
                      "description": "Rows accepted for sending, including delivered or replied rows. Can overlap with later failures."
                    },
                    "delivered_count": {
                      "type": "integer",
                      "description": "Delivered or replied rows."
                    },
                    "failed_count": {
                      "type": "integer",
                      "description": "Failed or undelivered rows."
                    },
                    "reply_count": {
                      "type": "integer",
                      "description": "Recipients marked replied."
                    },
                    "total_segments": {
                      "type": "integer",
                      "description": "Estimated sum of recipient segments."
                    }
                  },
                  "required": [
                    "campaign_id",
                    "agent_id",
                    "name",
                    "from_number",
                    "schedule_type",
                    "scheduled_date",
                    "window_start_minutes",
                    "window_end_minutes",
                    "window_days",
                    "timezone",
                    "source",
                    "status",
                    "total_count",
                    "started_at",
                    "completed_at",
                    "created_at",
                    "updated_at",
                    "allow_wider_hours",
                    "id",
                    "api_key_id",
                    "message_template",
                    "reply_context_prompt",
                    "reply_window_hours",
                    "is_active",
                    "claimed_at",
                    "sent_count",
                    "delivered_count",
                    "failed_count",
                    "reply_count",
                    "total_segments"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "agent_id": "agent_example",
                  "name": "Example SMS campaign",
                  "from_number": "+12025550101",
                  "schedule_type": "schedule",
                  "scheduled_date": "2030-11-04",
                  "window_start_minutes": null,
                  "window_end_minutes": null,
                  "window_days": null,
                  "timezone": null,
                  "source": "api",
                  "status": "scheduled",
                  "total_count": 1,
                  "started_at": null,
                  "completed_at": null,
                  "created_at": "2026-11-01T12:00:00Z",
                  "updated_at": "2026-11-01T12:00:00Z",
                  "allow_wider_hours": false,
                  "id": "00000000-0000-4000-8000-000000000001",
                  "api_key_id": "nxf_example",
                  "message_template": "Your requested reminder.",
                  "reply_context_prompt": "Answer questions about this requested appointment reminder.",
                  "reply_window_hours": 24,
                  "is_active": true,
                  "claimed_at": null,
                  "sent_count": 0,
                  "delivered_count": 0,
                  "failed_count": 0,
                  "reply_count": 0,
                  "total_segments": 0
                }
              }
            }
          },
          "400": {
            "description": "invalid_json: Invalid JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request exceeds the JSON body limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_active": {
                    "type": "boolean",
                    "description": "Enable or disable reply behaviour; does not stop dispatch."
                  },
                  "reply_context_prompt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Replace reply instructions; null clears."
                  },
                  "reply_window_hours": {
                    "type": "integer",
                    "description": "Saved reply association window in hours. Use a positive integer; no route-level range validator is declared.",
                    "minimum": 1
                  }
                },
                "description": "Send at least one supported field. Omitted fields stay unchanged; unknown fields are ignored. Database constraints still apply.",
                "additionalProperties": false,
                "minProperties": 1
              },
              "example": {
                "reply_context_prompt": "Answer questions about this requested appointment reminder.",
                "reply_window_hours": 24
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "SMS campaigns"
        ],
        "summary": "Delete an SMS campaign",
        "operationId": "deleteSmsCampaign",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Cancel waiting campaign work, hang up its running calls, then remove the campaign and recipient list. Calls already made and SMS already sent remain in history. Owner and Admin may delete; Member may not. Used charges and required financial evidence remain; no refund is made. A hangup_pending response queues durable completion without waiting for settlement. Repeating the same DELETE safely resumes the same request. A lost response is not confirmed success. Customer-managed copies are outside this operation. Bulk call deletion and account closure have separate contracts.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Owned campaign identifier. Missing and foreign IDs have the same 404.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Campaign and recipient list removed. Sent history and used charges remain.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "campaign_id",
                    "deleted",
                    "message"
                  ],
                  "properties": {
                    "campaign_id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "const": true
                    },
                    "message": {
                      "type": "string",
                      "const": "Campaign deleted"
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "campaign_id": "campaign_example",
                      "deleted": true,
                      "message": "Campaign deleted"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_delete: The identifier must contain 1–200 characters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "invalid_delete"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "invalid_delete": {
                    "value": {
                      "error": {
                        "type": "invalid_request",
                        "code": "invalid_delete",
                        "message": "Choose a valid call or campaign.",
                        "doc_url": "https://docs.nixflex.com/errors/invalid_delete",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Owner or Admin authority is required. A Member cannot delete content.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "permission_denied"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "permission_denied": {
                    "value": {
                      "error": {
                        "type": "permission_denied",
                        "code": "permission_denied",
                        "message": "Only an Admin or the Owner can do this.",
                        "doc_url": "https://docs.nixflex.com/errors/permission_denied",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: The item is missing or belongs to another account. These cases have the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "not_found"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "not_found": {
                    "value": {
                      "error": {
                        "type": "not_found",
                        "code": "not_found",
                        "message": "Campaign not found.",
                        "doc_url": "https://docs.nixflex.com/errors/not_found",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "hangup_pending: Hang-up is unconfirmed and durable deletion will continue. deletion_unavailable: The result could not be confirmed; check the list and repeat the same DELETE to resume any existing request safely.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "hangup_pending",
                            "deletion_unavailable"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "hangup_pending": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "hangup_pending",
                        "message": "Waiting work is cancelled. Some calls have not confirmed they ended yet. Deletion is queued and will finish once hang-up is confirmed.",
                        "doc_url": "https://docs.nixflex.com/errors/hangup_pending",
                        "details": {
                          "deleted": false,
                          "retry_pending": true
                        }
                      }
                    }
                  },
                  "deletion_unavailable": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "deletion_unavailable",
                        "message": "Deletion could not be confirmed. Check the list and try Delete again; an existing request will safely resume.",
                        "doc_url": "https://docs.nixflex.com/errors/deletion_unavailable",
                        "details": {
                          "deleted": false
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sms/campaigns/{id}/launch": {
      "post": {
        "operationId": "launchSmsCampaign",
        "summary": "Launch an SMS campaign",
        "description": "Request the first launch of an owned SMS campaign. Ownership, readiness and launch state are checked before dispatch; each recipient still passes current contact checks. No request body is used. This can contact real recipients. A second launch is refused after a campaign has been claimed, including finished runs. A missing or foreign campaign is reported as 400 invalid_request.\n\nConsent, suppression, recipient-local windows and capacity remain normal contact gates. A manual launch is not permission to bypass them. A 200 response may report running with held recipients. A refusal after some sends does not undo those sends.",
        "tags": [
          "SMS campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Exact saved campaign_id owned by this account. This operation does not declare a route-level length or character validator."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string",
                      "description": "Campaign ID."
                    },
                    "status": {
                      "type": "string",
                      "description": "running while held; otherwise done or failed."
                    },
                    "sent": {
                      "type": "integer",
                      "description": "Accepted sends; not delivery proof."
                    },
                    "failed": {
                      "type": "integer",
                      "description": "Known failures, distinct from accepted sends."
                    },
                    "total_segments": {
                      "type": "integer",
                      "description": "Segment count for this run."
                    },
                    "held": {
                      "type": "integer",
                      "description": "Held recipients when present."
                    },
                    "reason": {
                      "type": "string",
                      "description": "Hold reason when present."
                    },
                    "safe_to_retry": {
                      "type": "boolean",
                      "description": "False when held or outcome requires reconciliation."
                    },
                    "stopped": {
                      "type": "boolean",
                      "description": "Present when number changes stop a legacy run."
                    },
                    "stop_reason": {
                      "type": "string",
                      "description": "Why sending stopped."
                    },
                    "not_sent": {
                      "type": "integer",
                      "description": "Remaining unattempted recipients when known."
                    }
                  },
                  "required": [
                    "campaign_id",
                    "status",
                    "sent",
                    "failed",
                    "total_segments"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "status": "running",
                  "sent": 0,
                  "failed": 0,
                  "total_segments": 0,
                  "held": 1,
                  "reason": "recipients_held",
                  "safe_to_retry": false
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "account_inactive: Account sending is disabled. number_changed: The sending number changed. do_not_contact: The current recipient is suppressed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "campaign_outcome_unknown: A campaign save or launch result is uncertain. server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "campaigns_paused: Campaign admission is temporarily paused. dispatch_safety_unavailable: The current recipient was refused before sending because its safety record was unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/phone-numbers": {
      "post": {
        "tags": [
          "Phone numbers"
        ],
        "summary": "Import a phone number",
        "description": "Connect a number you already own to an active agent on the same account. Import can replace existing number routing, so another application using that routing can stop receiving calls or texts. Send the number and its active owned agent with exactly one complete carrier credential set. Keep credentials on your server.\n\nUnknown import fields are refused. Use only one connection credential set; do not mix it with another. custom_prompt does not configure the remaining per-number switches. If custom_prompt is omitted, it is saved as null; import does not copy the agent instructions. A later prompt update is a separate request that must be checked independently.",
        "operationId": "importPhoneNumber",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "object",
                      "properties": {
                        "phone_number": {
                          "type": "string",
                          "description": "Imported business number."
                        },
                        "agent_id": {
                          "type": "string",
                          "description": "Agent to which the number is attached."
                        },
                        "inbound_enabled": {
                          "type": "boolean",
                          "description": "Inbound calls are enabled on successful import.",
                          "const": true
                        },
                        "outbound_enabled": {
                          "type": "boolean",
                          "description": "Outbound calls are enabled on successful import.",
                          "const": true
                        }
                      },
                      "required": [
                        "phone_number",
                        "agent_id",
                        "inbound_enabled",
                        "outbound_enabled"
                      ],
                      "description": "Neutral fields from the imported number. Legacy identifier fields may also be present.",
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "phone_number"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "phone_number": {
                    "phone_number": "+12025550100",
                    "agent_id": "agent_0123456789abcdef",
                    "inbound_enabled": true,
                    "outbound_enabled": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone_format: The number format is invalid. Use a complete E.164 number. missing_field: A required number, agent or connection value is missing. Complete the privately prepared import payload; do not invent credential aliases. unknown_field: An unsupported import field was supplied. Use PATCH separately for other number settings. conflicting_fields: Two aliases supplied conflicting values. Supply each value once. mixed_provider_credentials: More than one connection credential set was supplied. Use the single connection that owns this number. custom_prompt_too_long: The prompt exceeds 8,000 characters. Shorten the number-specific prompt.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "account_unavailable: The account is not active. Resolve account access before attempting another number operation. agent_not_owned: The target agent belongs to another account. Choose an agent owned by the authenticated account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "agent_not_found: The target agent does not exist. Use a returned agent ID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "number_operation_pending: Another import or removal is pending. Read the current number and wait; do not change its routing. number_cleanup_uncertain: A previous routing change is unconfirmed. Contact support to reconcile it before importing or removing again. agent_unavailable: The target agent is not active. Choose an active owned agent. number_already_imported: The number is already imported. Read the existing number; use PATCH for a deliberate move or settings change. number_release_pending: A prior release needs reconciliation. Wait for its outcome to be resolved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "number_cleanup_uncertain: The routing outcome from this attempt is unconfirmed. Do not resend or change routing; reconcile through support. number_save_pending: Routing changed but local completion could not be confirmed. Read current state and contact support; never replay automatically. number_operation_unavailable: The operation could not be confirmed. Reconcile the number before another write.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Send the number and its active owned agent with exactly one complete carrier credential set. Keep credentials on your server.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone_number": {
                    "type": "string",
                    "description": "Business number. Up to 64 input characters; spaces, hyphens, parentheses and dots are removed before E.164 validation.",
                    "maxLength": 64
                  },
                  "agent_id": {
                    "type": "string",
                    "description": "Owned active agent identifier; trimmed, nonblank, at most 200 characters.",
                    "maxLength": 200
                  },
                  "custom_prompt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Optional number-specific prompt, at most 8,000 characters.",
                    "maxLength": 8000,
                    "default": null
                  },
                  "twilio_sid": {
                    "type": "string",
                    "description": "Carrier account SID. Use AC followed by 32 hexadecimal characters.",
                    "pattern": "^[Aa][Cc][A-Fa-f0-9]{32}$"
                  },
                  "twilio_token": {
                    "type": "string",
                    "maxLength": 4096,
                    "minLength": 1,
                    "writeOnly": true,
                    "description": "Private auth token for the account holding the number."
                  },
                  "telnyx_api_key": {
                    "type": "string",
                    "maxLength": 4096,
                    "minLength": 1,
                    "writeOnly": true,
                    "description": "Private carrier API key."
                  },
                  "telnyx_connection_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Voice application connection ID."
                  },
                  "telnyx_public_key": {
                    "type": "string",
                    "minLength": 44,
                    "maxLength": 44,
                    "description": "Optional public verification key, canonical base64 encoding exactly 32 bytes."
                  }
                },
                "required": [
                  "phone_number",
                  "agent_id"
                ],
                "description": "Send the number and its active owned agent with exactly one complete carrier credential set. Keep credentials on your server.",
                "additionalProperties": false,
                "oneOf": [
                  {
                    "required": [
                      "twilio_sid",
                      "twilio_token"
                    ],
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "telnyx_api_key"
                          ]
                        },
                        {
                          "required": [
                            "telnyx_connection_id"
                          ]
                        },
                        {
                          "required": [
                            "telnyx_public_key"
                          ]
                        }
                      ]
                    }
                  },
                  {
                    "required": [
                      "telnyx_api_key",
                      "telnyx_connection_id"
                    ],
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "twilio_sid"
                          ]
                        },
                        {
                          "required": [
                            "twilio_token"
                          ]
                        }
                      ]
                    }
                  }
                ]
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Phone numbers"
        ],
        "summary": "List phone numbers",
        "operationId": "listPhoneNumbers",
        "description": "Owned public numbers only; pending imports and internal browser identities are hidden. Without limit or cursor the response keeps its original shape. count is returned rows, not total. Paged reads order by created_at DESC NULLS LAST, phone_number DESC; live traversal, not a snapshot.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Opts into cursor paging; 1–100. Omitted with a cursor defaults to 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque next_cursor from the preceding page; keep the same account and filters.",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          },
          {
            "name": "agent_id",
            "in": "query",
            "description": "Only numbers assigned to this agent.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "count is this page size. next_cursor and has_more are present only in paged mode.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "phone_numbers",
                    "count"
                  ],
                  "properties": {
                    "phone_numbers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "api",
                              "dashboard",
                              null
                            ],
                            "readOnly": true,
                            "description": "Descriptive origin, never a permission or writable setting."
                          },
                          "created_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "web_agent_enabled": {
                            "type": "boolean"
                          },
                          "web_calls_enabled": {
                            "type": "boolean",
                            "description": "Saved switch; website voice also needs Web agent ON."
                          },
                          "web_functions_enabled": {
                            "type": "boolean"
                          },
                          "monitor_enabled": {
                            "type": "boolean"
                          },
                          "phone_number": {
                            "type": "string",
                            "example": "+447446466847"
                          },
                          "agent_id": {
                            "type": "string"
                          },
                          "inbound_enabled": {
                            "type": "boolean"
                          },
                          "outbound_enabled": {
                            "type": "boolean"
                          },
                          "custom_prompt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "voice_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sms_reply_enabled": {
                            "type": "boolean"
                          },
                          "voicemail_leave_enabled": {
                            "type": [
                              "boolean",
                              "null"
                            ],
                            "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",
                              "null"
                            ]
                          },
                          "sms_prompt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "web_prompt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "speaking_rate": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "dtmf_enabled": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "require_booking_confirmation": {
                            "type": [
                              "boolean",
                              "null"
                            ],
                            "description": "Saved confirmation setting for supported calendar changes. A new voice booking always requires one combined read-back and one clear yes, even when false. A null number override inherits the agent."
                          },
                          "record_call": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "recording_source": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "provider",
                              "nixflex"
                            ],
                            "description": "Who records on this number. null = inherit the agent."
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "phone_numbers": [],
                  "count": 0,
                  "next_cursor": null,
                  "has_more": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid phone-number paging or filter query.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "type": "invalid_request",
                    "code": "invalid_number_query",
                    "message": "Invalid phone-number paging or filter query.",
                    "doc_url": "https://docs.nixflex.com/errors/invalid_number_query",
                    "details": {}
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "type": "authentication_error",
                    "code": "unauthorized",
                    "message": "Invalid or missing API key",
                    "doc_url": "https://docs.nixflex.com/errors/unauthorized",
                    "details": {}
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/phone-numbers/{phoneNumber}/usage": {
      "get": {
        "tags": [
          "Phone numbers"
        ],
        "summary": "Get number usage",
        "operationId": "getPhoneNumberUsage",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\+[1-9][0-9]{6,14}$"
            },
            "description": "Owned public E.164 number. URL-encode the plus."
          },
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "today",
                "7",
                "14",
                "30",
                "90",
                "all"
              ],
              "default": "all"
            },
            "description": "Calendar days including today, not rolling hours. All means retained history."
          },
          {
            "name": "time_zone",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "default": "UTC"
            },
            "description": "IANA zone such as Europe/London, or UTC. Match the dashboard browser zone."
          }
        ],
        "responses": {
          "200": {
            "description": "Complete aggregate; never truncated partial totals.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "usage"
                  ],
                  "properties": {
                    "usage": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "phone_number",
                        "period",
                        "time_zone",
                        "period_start",
                        "period_end",
                        "start_inclusive",
                        "end_inclusive",
                        "currency",
                        "duration_unit",
                        "call_count",
                        "total_ms",
                        "minutes",
                        "last_call",
                        "total_cost",
                        "unpriced_calls",
                        "sms_sent",
                        "sms_received",
                        "sms_count",
                        "web_chats",
                        "unused",
                        "history_note"
                      ],
                      "properties": {
                        "phone_number": {
                          "type": "string"
                        },
                        "period": {
                          "type": "string",
                          "enum": [
                            "today",
                            "7",
                            "14",
                            "30",
                            "90",
                            "all"
                          ]
                        },
                        "time_zone": {
                          "type": "string"
                        },
                        "period_start": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time",
                          "description": "Inclusive boundary; null for all retained history."
                        },
                        "period_end": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Inclusive server query cutoff."
                        },
                        "start_inclusive": {
                          "type": "boolean",
                          "const": true
                        },
                        "end_inclusive": {
                          "type": "boolean",
                          "const": true
                        },
                        "currency": {
                          "type": "string",
                          "const": "USD"
                        },
                        "duration_unit": {
                          "type": "string",
                          "const": "milliseconds"
                        },
                        "call_count": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "total_ms": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "minutes": {
                          "type": "number",
                          "description": "total_ms / 60000, rounded to six decimals. total_ms is authoritative."
                        },
                        "last_call": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "total_cost": {
                          "type": "string",
                          "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
                          "description": "Exact decimal USD sum of retained calls.cost. No repricing. Display to two decimals to match the dashboard."
                        },
                        "unpriced_calls": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Retained calls where cost IS NULL, not zero."
                        },
                        "sms_sent": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "sms_received": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "sms_count": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "web_chats": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Distinct session IDs with messages in the period, bound to the current number row and owner."
                        },
                        "unused": {
                          "type": "boolean",
                          "description": "Zero calls AND zero SMS in this period; web chats do not affect this field."
                        },
                        "history_note": {
                          "type": "string",
                          "description": "Retained history, not a billing ledger; only recorded call charges, no provider SMS charges."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone_format, invalid_period, invalid_timezone or invalid_query. Duplicate/unknown query fields are rejected."
          },
          "401": {
            "description": "Missing/invalid API key or inactive account at authentication."
          },
          "403": {
            "description": "account_unavailable: account became inactive before the database read."
          },
          "404": {
            "description": "number_not_found: absent, foreign, pending or internal identity."
          },
          "429": {
            "description": "Existing API rate limit."
          },
          "503": {
            "description": "usage_unavailable: timeout, unavailable schema/database or invalid result. Not zero usage; use a shorter period or retry later."
          }
        }
      }
    },
    "/phone-numbers/{phoneNumber}": {
      "get": {
        "tags": [
          "Phone numbers"
        ],
        "summary": "Get a phone number",
        "operationId": "getPhoneNumber",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Saved safe settings, not inherited values.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "phone_number"
                  ],
                  "properties": {
                    "phone_number": {
                      "type": "object",
                      "description": "Explicit safe saved settings. Null means unset, not a resolved agent value. No credentials or internal IDs.",
                      "additionalProperties": false,
                      "required": [
                        "phone_number",
                        "agent_id",
                        "source",
                        "created_at",
                        "inbound_enabled",
                        "outbound_enabled",
                        "sms_reply_enabled",
                        "web_agent_enabled",
                        "web_calls_enabled",
                        "web_functions_enabled",
                        "monitor_enabled",
                        "custom_prompt",
                        "sms_prompt",
                        "web_prompt",
                        "voice_id",
                        "speaking_rate",
                        "dtmf_enabled",
                        "require_booking_confirmation",
                        "record_call",
                        "recording_source",
                        "voicemail_leave_enabled",
                        "voicemail_message",
                        "web_calls_effective"
                      ],
                      "properties": {
                        "phone_number": {
                          "type": "string"
                        },
                        "agent_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "source": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "api",
                            "dashboard",
                            null
                          ],
                          "readOnly": true,
                          "description": "Descriptive only, not writable or a permission."
                        },
                        "created_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "inbound_enabled": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "outbound_enabled": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "sms_reply_enabled": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "web_agent_enabled": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "web_calls_enabled": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "web_functions_enabled": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "monitor_enabled": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "custom_prompt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "sms_prompt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "web_prompt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "voice_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "speaking_rate": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "dtmf_enabled": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "require_booking_confirmation": {
                          "type": [
                            "boolean",
                            "null"
                          ],
                          "description": "Saved confirmation setting for supported calendar changes. A new voice booking always requires one combined read-back and one clear yes, even when false. A null number override inherits the agent."
                        },
                        "record_call": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "recording_source": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "provider",
                            "nixflex",
                            null
                          ]
                        },
                        "voicemail_leave_enabled": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "voicemail_message": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "web_calls_effective": {
                          "type": "boolean",
                          "readOnly": true,
                          "description": "Saved website voice true and Web agent not false (legacy null retains old semantics). Switch eligibility only; active/billing admission still applies."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid E.164 phone number."
          },
          "401": {
            "description": "Invalid key or inactive account."
          },
          "404": {
            "description": "Missing, foreign, pending or internal browser identity; number_not_found."
          },
          "429": {
            "description": "Rate limit exceeded."
          },
          "500": {
            "description": "Database read failed, not an empty successful result."
          }
        },
        "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",
        "description": "Change per-number settings, or move the number to another active agent on the same account. A move and a settings update are separate requests. Omitted settings remain unchanged. The six strict switches below accept only JSON booleans; sms_reply_enabled and older override fields retain their documented legacy coercion. Use canonical snake_case names. A saved web_calls_enabled value does not confirm that all effective web-call prerequisites are satisfied.\n\n### Number controls\n\nThe seven switches cover inbound, outbound, SMS reply, web agent, web calls, web functions and saved monitor permission. Off switches can prevent new work without ending an existing call. Read the number to confirm saved and effective state.\n\n### Move to another agent\n\nSend only `{ \"agent_id\": \"agent_TARGET\" }`. The move preserves number-specific settings and history and does not change carrier routing. New work uses the target agent. A busy number is refused. Repeating the same settled assignment returns changed: false. The move response contains agent_name and changed, while a settings response contains saved settings.\n\nRead web_calls_effective from the number detail endpoint to check effective website access. Saved permission does not start a monitor session. Never delete and re-import a number just to move it between agents.\n\n<span id=\"request\"></span>\n<span id=\"what-changes-and-what-stays\"></span>\n<span id=\"kits-localunpublished\"></span>\n<span id=\"dashboard-integration-for-chat-b\"></span>\n<span id=\"node-and-cli-local-unpublished-build\"></span>\n<span id=\"python-local-unpublished-build\"></span>\n<span id=\"mcp-local-unpublished-build\"></span>",
        "operationId": "updatePhoneNumber",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Business number. Use E.164 and URL-encode the leading + as %2B."
            },
            "description": "Business number. Use E.164 and URL-encode the leading + as %2B."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "phone_number": {
                              "type": "string",
                              "description": "Updated number."
                            },
                            "agent_id": {
                              "type": "string",
                              "description": "Current agent ID."
                            },
                            "inbound_enabled": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Saved channel switch. Must be a JSON boolean. Omitted stays unchanged."
                            },
                            "outbound_enabled": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Saved channel switch. Must be a JSON boolean. Omitted stays unchanged."
                            },
                            "monitor_enabled": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Saved monitor permission; not a live listener control. Must be a JSON boolean."
                            },
                            "web_calls_enabled": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Saved channel switch. Must be a JSON boolean. Omitted stays unchanged."
                            },
                            "web_agent_enabled": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Saved channel switch. Must be a JSON boolean. Omitted stays unchanged."
                            },
                            "web_functions_enabled": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Saved channel switch. Must be a JSON boolean. Omitted stays unchanged."
                            },
                            "custom_prompt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Number prompt override. Null or empty clears to null.",
                              "maxLength": 8000
                            },
                            "voice_id": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Existing voice alias override. Trimmed; null or empty clears to null. No route-level length cap is declared."
                            },
                            "sms_reply_enabled": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "SMS auto-reply switch. The string true is also accepted; use JSON booleans."
                            },
                            "sms_prompt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "SMS prompt override. Null or empty stores an empty string.",
                              "maxLength": 20000
                            },
                            "web_prompt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Web prompt override. Null or empty stores an empty string. Limit is 16,000 UTF-16 code units.",
                              "maxLength": 16000
                            },
                            "speaking_rate": {
                              "type": [
                                "number",
                                "null",
                                "string"
                              ],
                              "description": "Number values are clamped to 0.5–1.5. Null or an empty string clears to inheritance; use 1 for normal speed."
                            },
                            "dtmf_enabled": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Keypad override. Null or empty clears to inheritance; the string true is also accepted."
                            },
                            "require_booking_confirmation": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Saved confirmation setting for supported calendar changes. A new voice booking always requires one combined read-back and one clear yes, even when false. A null number override inherits the agent."
                            },
                            "record_call": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Recording override; null inherits the agent."
                            },
                            "recording_source": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "provider or nixflex; null or empty inherits the agent. Case and surrounding whitespace are normalised.",
                              "enum": [
                                "provider",
                                "nixflex",
                                null,
                                ""
                              ]
                            },
                            "voicemail_leave_enabled": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Number-specific voicemail setting; null is unset. When enabled, the merged message must be nonblank."
                            },
                            "voicemail_message": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Number-specific message. Null or empty clears to null.",
                              "maxLength": 2000
                            }
                          },
                          "required": [
                            "phone_number",
                            "agent_id"
                          ],
                          "description": "Saved settings projection.",
                          "additionalProperties": true
                        },
                        {
                          "type": "object",
                          "properties": {
                            "phone_number": {
                              "type": "string",
                              "description": "Moved number."
                            },
                            "agent_id": {
                              "type": "string",
                              "description": "Target agent ID."
                            },
                            "agent_name": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "Target agent name."
                            },
                            "changed": {
                              "type": "boolean",
                              "description": "False if already assigned to this agent; true if the assignment changed."
                            }
                          },
                          "required": [
                            "phone_number",
                            "agent_id",
                            "agent_name",
                            "changed"
                          ],
                          "description": "",
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "phone_number"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "phone_number": {
                    "phone_number": "+12025550100",
                    "agent_id": "agent_0123456789abcdef",
                    "custom_prompt": "Example number instructions."
                  }
                }
              }
            }
          },
          "400": {
            "description": "missing_field: No recognised setting was supplied. Send a documented setting, or agent_id alone for a move. invalid_number_control: A strict switch is not a JSON boolean or aliases conflict. Send true or false once for that switch. invalid_agent_move: A move contains other settings or an invalid agent ID. Send only agent_id; update settings separately. invalid_number: A move URL does not contain a complete E.164 number. Correct and URL-encode the number. custom_prompt_too_long: The number prompt exceeds 8,000 characters. Shorten it. sms_prompt_too_long: The SMS prompt exceeds 20,000 characters. Shorten it. web_prompt_too_long: The web prompt exceeds 16,000 UTF-16 code units. Shorten it. voicemail_message_too_long: The voicemail message exceeds 2,000 characters. Shorten it. voicemail_message_required: The merged settings enable voicemail without a message. Supply the message or disable voicemail. invalid_recording_source: The recording source value is unsupported. Use provider, nixflex or null.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "number_not_found: The number is not owned by this account. Use the exact number returned by an account list. agent_not_found: The move target is not an owned agent. Use an owned agent ID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "agent_unavailable: The target agent is not active. Choose an active agent. number_busy: A call, reply, campaign or number operation is active. Wait for that work to finish before deciding on a move.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "db_update_failed: Settings storage failed. Read the number and reconcile the intended values. server_error: The update result could not be confirmed. Read current settings before another attempt.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "number_move_disabled: Number moves are not enabled. Use the existing assignment until moves are enabled. number_move_unconfirmed: The move result could not be confirmed. Read the number before another write.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "inbound_enabled": {
                        "type": "boolean",
                        "description": "Saved channel switch. Must be a JSON boolean. Omitted stays unchanged."
                      },
                      "outbound_enabled": {
                        "type": "boolean",
                        "description": "Saved channel switch. Must be a JSON boolean. Omitted stays unchanged."
                      },
                      "monitor_enabled": {
                        "type": "boolean",
                        "description": "Saved monitor permission; not a live listener control. Must be a JSON boolean."
                      },
                      "web_calls_enabled": {
                        "type": "boolean",
                        "description": "Saved channel switch. Must be a JSON boolean. Omitted stays unchanged."
                      },
                      "web_agent_enabled": {
                        "type": "boolean",
                        "description": "Saved channel switch. Must be a JSON boolean. Omitted stays unchanged."
                      },
                      "web_functions_enabled": {
                        "type": "boolean",
                        "description": "Saved channel switch. Must be a JSON boolean. Omitted stays unchanged."
                      },
                      "custom_prompt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Number prompt override. Null or empty clears to null.",
                        "maxLength": 8000
                      },
                      "voice_id": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Existing voice alias override. Trimmed; null or empty clears to null. No route-level length cap is declared."
                      },
                      "sms_reply_enabled": {
                        "type": "boolean",
                        "description": "SMS auto-reply switch. The string true is also accepted; use JSON booleans."
                      },
                      "sms_prompt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "SMS prompt override. Null or empty stores an empty string.",
                        "maxLength": 20000
                      },
                      "web_prompt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Web prompt override. Null or empty stores an empty string. Limit is 16,000 UTF-16 code units.",
                        "maxLength": 16000
                      },
                      "speaking_rate": {
                        "type": [
                          "number",
                          "null",
                          "string"
                        ],
                        "description": "Number values are clamped to 0.5–1.5. Null or an empty string clears to inheritance; use 1 for normal speed.",
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          },
                          {
                            "type": "string",
                            "const": ""
                          }
                        ]
                      },
                      "dtmf_enabled": {
                        "type": [
                          "boolean",
                          "null"
                        ],
                        "description": "Keypad override. Null or empty clears to inheritance; the string true is also accepted."
                      },
                      "require_booking_confirmation": {
                        "type": [
                          "boolean",
                          "null"
                        ],
                        "description": "Saved confirmation setting for supported calendar changes. A new voice booking always requires one combined read-back and one clear yes, even when false. A null number override inherits the agent."
                      },
                      "record_call": {
                        "type": [
                          "boolean",
                          "null"
                        ],
                        "description": "Recording override; null inherits the agent."
                      },
                      "recording_source": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "provider or nixflex; null or empty inherits the agent. Case and surrounding whitespace are normalised.",
                        "enum": [
                          "provider",
                          "nixflex",
                          null,
                          ""
                        ]
                      },
                      "voicemail_leave_enabled": {
                        "type": [
                          "boolean",
                          "null"
                        ],
                        "description": "Number-specific voicemail setting; null is unset. When enabled, the merged message must be nonblank."
                      },
                      "voicemail_message": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Number-specific message. Null or empty clears to null.",
                        "maxLength": 2000
                      },
                      "voice_key": {
                        "type": "string",
                        "description": "Main catalogue voice key. Send all four voice pair fields together."
                      },
                      "voice_route_key": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Selected route for the main voice."
                      },
                      "backup_voice_key": {
                        "type": "string",
                        "description": "Backup catalogue voice key. Required when saving a pair."
                      },
                      "backup_voice_route_key": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Selected route for the backup voice."
                      },
                      "voice_pair_inherit": {
                        "type": "boolean",
                        "description": "Set true to inherit the agent’s saved pair. Omit competing pair values."
                      }
                    },
                    "description": "Partial settings update; at least one recognised setting is required. Unknown-only input is refused.",
                    "additionalProperties": true,
                    "minProperties": 1,
                    "not": {
                      "required": [
                        "agent_id"
                      ]
                    }
                  },
                  {
                    "type": "object",
                    "properties": {
                      "agent_id": {
                        "type": "string",
                        "description": "Owned active target agent ID. Send this field alone.",
                        "minLength": 1,
                        "maxLength": 200
                      }
                    },
                    "required": [
                      "agent_id"
                    ],
                    "description": "",
                    "additionalProperties": false
                  }
                ]
              },
              "example": {
                "custom_prompt": "Example number instructions."
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Phone numbers"
        ],
        "summary": "Remove a phone number",
        "description": "Disconnect an owned number from Nixflex and clear the routing managed by this import. This does not release the number from its carrier account or end that account’s charges. No request body is required. Use the exact owned business number and URL-encode the leading +. Removal can affect new calls and messages using this number. Do not use it as a request to erase all call history, account data, or copies in external storage.",
        "operationId": "deletePhoneNumber",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Business number. Use E.164 and URL-encode the leading + as %2B."
            },
            "description": "Business number. Use E.164 and URL-encode the leading + as %2B."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "object",
                      "properties": {
                        "phone_number": {
                          "type": "string",
                          "description": "Removed business number."
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": "The number removal completed.",
                          "const": true
                        }
                      },
                      "required": [
                        "phone_number",
                        "deleted"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "phone_number"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "phone_number": {
                    "phone_number": "+12025550100",
                    "deleted": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone_format: The number format is invalid. Use a complete E.164 number.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "account_unavailable: The account is not active. Resolve account access before attempting another number operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "number_not_found: The number is not on this account. Check the owning account and exact number.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "number_operation_pending: Another import or removal is pending. Read the current number and wait; do not change its routing. number_cleanup_uncertain: A previous routing change is unconfirmed. Contact support to reconcile it before importing or removing again. number_cleanup_credentials_missing: The existing connection lacks the credentials needed to clear routing. Restore the existing connection through the supported account workflow before removal.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "number_cleanup_uncertain: The routing outcome from this attempt is unconfirmed. Do not resend or change routing; reconcile through support. number_save_pending: Routing changed but local completion could not be confirmed. Read current state and contact support; never replay automatically. number_operation_unavailable: The operation could not be confirmed. Reconcile the number before another write.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/keys": {
      "post": {
        "tags": [
          "Account and keys"
        ],
        "summary": "Create an API account",
        "description": "Create a separate API-only account and its credential. This does not add another key to an existing organisation, create a dashboard login, or grant trial credit. Send a JSON object. Unknown fields are not a supported way to configure an account. Signup is limited to three requests per hour per address. Existing application keys belong to their existing account; use rotation to replace a secret.",
        "operationId": "createKey",
        "security": [],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Save the returned credential securely; the secret is returned only by creation or rotation."
                    },
                    "key_id": {
                      "type": "string",
                      "description": "Stable API account identifier."
                    },
                    "key_secret": {
                      "type": "string",
                      "description": "Sensitive secret. Never log, share or commit it."
                    }
                  },
                  "required": [
                    "message",
                    "key_id",
                    "key_secret"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "message": "API key created. Save your key_secret — it will not be shown again.",
                  "key_id": "nxf_EXAMPLE",
                  "key_secret": "nxfs_REPLACE_WITH_SAVED_SECRET"
                }
              }
            }
          },
          "400": {
            "description": "invalid_json: The request body is not valid JSON. Fix the JSON syntax before sending it.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The JSON body exceeds the request parser limit. Send a smaller JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "key_creation_rate_limited: The address has reached the signup limit of three requests per hour. Wait for Retry-After; do not create extra accounts to work around a refusal.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "server_error: The account result could not be confirmed. Do not repeat signup automatically; ask support to reconcile the named request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Optional account label. Omitted or empty is stored as null; no route-level text length limit is declared.",
                    "default": null
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Optional contact label. This route does not verify ownership or validate email format. Omitted or empty becomes null.",
                    "default": null
                  }
                },
                "description": "",
                "additionalProperties": false
              },
              "example": {
                "name": "Example API account"
              }
            }
          }
        }
      }
    },
    "/keys/rotate": {
      "post": {
        "tags": [
          "Account and keys"
        ],
        "summary": "Rotate the API key",
        "description": "Replace the current account secret immediately. The key ID remains the same; the old secret stops working when rotation succeeds. The organisation signing secret is separate and does not rotate here. No path, query or body fields are required. Use the current account credential. Coordinate application secret replacement and a possible interruption; this endpoint provides no overlap window for old and new secrets.",
        "operationId": "rotateKey",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Save the returned credential securely; the secret is returned only by creation or rotation."
                    },
                    "key_id": {
                      "type": "string",
                      "description": "Stable API account identifier."
                    },
                    "key_secret": {
                      "type": "string",
                      "description": "Sensitive secret. Never log, share or commit it."
                    }
                  },
                  "required": [
                    "message",
                    "key_id",
                    "key_secret"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "message": "API key secret rotated. Save your new key_secret - it will not be shown again. Update your applications immediately.",
                  "key_id": "nxf_EXAMPLE",
                  "key_secret": "nxfs_NEW_SECRET_EXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "server_error: The rotation result could not be confirmed. Do not rotate again blindly. Check which credential still authenticates and use the account recovery process if the new secret was lost.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/usage": {
      "get": {
        "tags": [
          "Account and keys"
        ],
        "summary": "Get account usage",
        "description": "Read stored account usage and call-capacity information. Occupancy can include unresolved reservations, so it is not simply the number of connected conversations. No request fields are required. The three reservation fields are present only when that capacity implementation is enabled. Historical counters are not a complete billing ledger. Optional fields can be absent; preserve null values instead of turning them into zero.",
        "operationId": "getUsage",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved account plan label."
                    },
                    "total_calls": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Stored account call counter."
                    },
                    "total_minutes": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Stored account minutes; can be fractional."
                    },
                    "total_cost": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Stored account cost value; this is not an invoice or independent carrier charge total."
                    },
                    "rate_limit_per_minute": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Saved request limit. Request headers describe the effective limit."
                    },
                    "max_concurrent": {
                      "type": "integer",
                      "description": "Current configured call capacity; the default is 10 when no positive limit is stored.",
                      "minimum": 0
                    },
                    "peak_concurrent_this_month": {
                      "type": "integer",
                      "description": "Observed monthly peak; best-effort measurement.",
                      "minimum": 0
                    },
                    "rejected_at_cap_this_month": {
                      "type": "integer",
                      "description": "Recorded monthly refusals at capacity; best-effort telemetry can be zero when unavailable.",
                      "minimum": 0
                    },
                    "occupied_call_slots": {
                      "type": "integer",
                      "description": "Optional owned reservation count, including unresolved reservations.",
                      "minimum": 0
                    },
                    "capacity_source": {
                      "type": "string",
                      "description": "Present with owned-reservation capacity.",
                      "const": "owned_reservations"
                    },
                    "capacity_measured_since": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Optional start of capacity measurement.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "plan",
                    "total_calls",
                    "total_minutes",
                    "total_cost",
                    "rate_limit_per_minute",
                    "max_concurrent",
                    "peak_concurrent_this_month",
                    "rejected_at_cap_this_month"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "plan": "example",
                  "total_calls": 12,
                  "total_minutes": 7.5,
                  "total_cost": 0.75,
                  "rate_limit_per_minute": 300,
                  "max_concurrent": 10,
                  "peak_concurrent_this_month": 2,
                  "rejected_at_cap_this_month": 0,
                  "occupied_call_slots": 0,
                  "capacity_source": "owned_reservations",
                  "capacity_measured_since": "2026-11-01T00:00:00.000Z"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "capacity_lookup_unavailable: The current owned call capacity could not be confirmed. Wait and retry the read; do not invent zero occupancy.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/integrations/webhook/number/{phoneNumber}": {
      "put": {
        "operationId": "setWebhook",
        "summary": "Set first webhook",
        "description": "Set the first webhook setting for an owned number. Each webhook slot is independent. Saved destinations receive call events when the relevant delivery feature is available. The GET response returns the saved URL. Keep URLs private because they can contain credentials. Setting a URL does not test delivery or verify the destination.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "provider": {
                      "type": "string",
                      "description": "Integration identifier.",
                      "const": "webhook"
                    }
                  },
                  "required": [
                    "ok",
                    "phone_number",
                    "provider"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "phone_number": "+12025550100",
                  "provider": "webhook"
                }
              }
            }
          },
          "400": {
            "description": "missing_field: A required field is missing or has the wrong type. invalid_url: The destination URL is not accepted. invalid_phone: The number is not valid E.164. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "HTTPS destination. The handler trims the value and requires the https:// prefix."
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false,
                "description": ""
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getWebhook",
        "summary": "Get first webhook",
        "description": "Read the saved first webhook setting for an owned number. Each webhook slot is independent. Saved destinations receive call events when the relevant delivery feature is available. The GET response returns the saved URL. Keep URLs private because they can contain credentials. Setting a URL does not test delivery or verify the destination.\n\nThe K4 MCP get_webhook response masks the saved URL. Its delete_webhook preview also masks the URL; SDK responses remain private wire data. Do not log them.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "webhook_url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved URL or null. Treat destination URLs as private."
                    },
                    "is_set": {
                      "type": "boolean",
                      "description": "A URL is saved at this exact level; does not resolve inheritance."
                    }
                  },
                  "required": [
                    "phone_number",
                    "webhook_url",
                    "is_set"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "phone_number": "+12025550100",
                  "webhook_url": null,
                  "is_set": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhook",
        "summary": "Clear first webhook",
        "description": "Clear the saved first webhook setting for an owned number. Each webhook slot is independent. Saved destinations receive call events when the relevant delivery feature is available. The GET response returns the saved URL. Keep URLs private because they can contain credentials. Setting a URL does not test delivery or verify the destination. MCP delete preview masks the configured webhook URL; it does not expose the destination.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Delete request completed.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    }
                  },
                  "required": [
                    "ok",
                    "deleted",
                    "phone_number"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "deleted": true,
                  "phone_number": "+12025550100"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/webhook2/number/{phoneNumber}": {
      "put": {
        "operationId": "setWebhook2",
        "summary": "Set second webhook",
        "description": "Set the second webhook setting for an owned number. Each webhook slot is independent. Saved destinations receive call events when the relevant delivery feature is available. The GET response returns the saved URL. Keep URLs private because they can contain credentials. Setting a URL does not test delivery or verify the destination.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "provider": {
                      "type": "string",
                      "description": "Integration identifier.",
                      "const": "webhook2"
                    }
                  },
                  "required": [
                    "ok",
                    "phone_number",
                    "provider"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "phone_number": "+12025550100",
                  "provider": "webhook2"
                }
              }
            }
          },
          "400": {
            "description": "missing_field: A required field is missing or has the wrong type. invalid_url: The destination URL is not accepted. invalid_phone: The number is not valid E.164. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "HTTPS destination. The handler trims the value and requires the https:// prefix."
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false,
                "description": ""
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getWebhook2",
        "summary": "Get second webhook",
        "description": "Read the saved second webhook setting for an owned number. Each webhook slot is independent. Saved destinations receive call events when the relevant delivery feature is available. The GET response returns the saved URL. Keep URLs private because they can contain credentials. Setting a URL does not test delivery or verify the destination.\n\nThe K4 MCP get_webhook response masks the saved URL. Its delete_webhook preview also masks the URL; SDK responses remain private wire data. Do not log them.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "webhook_url_2": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved URL or null. Treat destination URLs as private."
                    },
                    "is_set": {
                      "type": "boolean",
                      "description": "A URL is saved at this exact level; does not resolve inheritance."
                    }
                  },
                  "required": [
                    "phone_number",
                    "webhook_url_2",
                    "is_set"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "phone_number": "+12025550100",
                  "webhook_url_2": null,
                  "is_set": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhook2",
        "summary": "Clear second webhook",
        "description": "Clear the saved second webhook setting for an owned number. Each webhook slot is independent. Saved destinations receive call events when the relevant delivery feature is available. The GET response returns the saved URL. Keep URLs private because they can contain credentials. Setting a URL does not test delivery or verify the destination. MCP delete preview masks the configured webhook URL; it does not expose the destination.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Delete request completed.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    }
                  },
                  "required": [
                    "ok",
                    "deleted",
                    "phone_number"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "deleted": true,
                  "phone_number": "+12025550100"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/zapier/number/{phoneNumber}": {
      "put": {
        "operationId": "setZapier",
        "summary": "Set Zapier settings",
        "description": "Save Zapier settings for an owned phone number. This replaces the saved configuration for this integration; omitted configuration values do not preserve the old values. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "provider": {
                      "type": "string",
                      "description": "Integration identifier.",
                      "const": "zapier"
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Whether the saved integration is enabled."
                    }
                  },
                  "required": [
                    "ok",
                    "phone_number",
                    "provider",
                    "is_active"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "phone_number": "+12025550100",
                  "provider": "zapier",
                  "is_active": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone: The number is not valid E.164. missing_field: A required field is missing or has the wrong type. invalid_url: The destination URL is not accepted. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_active": {
                    "type": "boolean",
                    "description": "Only literal false disables this configuration.",
                    "default": true
                  },
                  "agent_id": {
                    "type": "string",
                    "description": "Fallback agent ID used only when the number has no assigned agent; does not move the number."
                  },
                  "post_call_url": {
                    "type": "string",
                    "description": "HTTPS destination. The handler trims the value and requires the https:// prefix.",
                    "writeOnly": true
                  }
                },
                "required": [
                  "post_call_url"
                ],
                "additionalProperties": false,
                "description": "Send a JSON object. Credential values must stay private."
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getZapier",
        "summary": "Get Zapier settings",
        "description": "Read the saved Zapier settings for an owned phone number. Secret values are represented by configuration flags. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Whether the saved integration is enabled."
                    },
                    "post_call_url_set": {
                      "type": "boolean",
                      "description": "A post-call destination is configured."
                    }
                  },
                  "required": [
                    "phone_number",
                    "is_active",
                    "post_call_url_set"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "phone_number": "+12025550100",
                  "is_active": true,
                  "post_call_url_set": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteZapier",
        "summary": "Delete Zapier settings",
        "description": "Remove the saved Zapier configuration scoped to this account and number. This does not disconnect the phone number. A missing configuration also returns success. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Delete request completed.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    }
                  },
                  "required": [
                    "ok",
                    "deleted",
                    "phone_number"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "deleted": true,
                  "phone_number": "+12025550100"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/make/number/{phoneNumber}": {
      "put": {
        "operationId": "setMake",
        "summary": "Set Make settings",
        "description": "Save Make settings for an owned phone number. This replaces the saved configuration for this integration; omitted configuration values do not preserve the old values. At least one of post_call_url or in_call_url is required. Only supplied URLs are saved; omitting an old URL removes it from this configuration.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "provider": {
                      "type": "string",
                      "description": "Integration identifier.",
                      "const": "make"
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Whether the saved integration is enabled."
                    }
                  },
                  "required": [
                    "ok",
                    "phone_number",
                    "provider",
                    "is_active"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "phone_number": "+12025550100",
                  "provider": "make",
                  "is_active": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone: The number is not valid E.164. missing_field: A required field is missing or has the wrong type. invalid_url: The destination URL is not accepted. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_active": {
                    "type": "boolean",
                    "description": "Only literal false disables this configuration.",
                    "default": true
                  },
                  "agent_id": {
                    "type": "string",
                    "description": "Fallback agent ID used only when the number has no assigned agent; does not move the number."
                  },
                  "post_call_url": {
                    "type": "string",
                    "description": "HTTPS destination for post-call events. Supply this or in_call_url.",
                    "writeOnly": true
                  },
                  "in_call_url": {
                    "type": "string",
                    "description": "HTTPS destination called by the in-call tool. Supply this or post_call_url.",
                    "writeOnly": true
                  },
                  "tool_name": {
                    "type": "string",
                    "description": "Used only when in_call_url is supplied.",
                    "default": "make_action"
                  },
                  "tool_description": {
                    "type": "string",
                    "description": "In-call tool description; ignored without in_call_url.",
                    "default": "Send the details collected on this call to an external workflow and use the response in the conversation."
                  },
                  "parameters": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "In-call tool JSON schema. Used only with in_call_url.",
                    "default": {
                      "type": "object",
                      "properties": {}
                    }
                  }
                },
                "additionalProperties": false,
                "description": "Send a JSON object. Credential values must stay private.",
                "anyOf": [
                  {
                    "required": [
                      "post_call_url"
                    ]
                  },
                  {
                    "required": [
                      "in_call_url"
                    ]
                  }
                ]
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getMake",
        "summary": "Get Make settings",
        "description": "Read the saved Make settings for an owned phone number. Secret values are represented by configuration flags. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Whether the saved integration is enabled."
                    },
                    "post_call_url_set": {
                      "type": "boolean",
                      "description": "A post-call URL is saved."
                    },
                    "in_call_url_set": {
                      "type": "boolean",
                      "description": "An in-call URL is saved."
                    },
                    "tool_name": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved tool name."
                    },
                    "tool_description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved tool description."
                    },
                    "parameters": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true,
                      "description": "JSON object; nested properties are supplied by your integration."
                    }
                  },
                  "required": [
                    "phone_number",
                    "is_active",
                    "post_call_url_set",
                    "in_call_url_set",
                    "tool_name",
                    "tool_description",
                    "parameters"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "phone_number": "+12025550100",
                  "is_active": true,
                  "post_call_url_set": true,
                  "in_call_url_set": false,
                  "tool_name": null,
                  "tool_description": null,
                  "parameters": null
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteMake",
        "summary": "Delete Make settings",
        "description": "Remove the saved Make configuration scoped to this account and number. This does not disconnect the phone number. A missing configuration also returns success. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Delete request completed.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    }
                  },
                  "required": [
                    "ok",
                    "deleted",
                    "phone_number"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "deleted": true,
                  "phone_number": "+12025550100"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/gohighlevel/number/{phoneNumber}": {
      "put": {
        "operationId": "setGohighlevel",
        "summary": "Set GoHighLevel settings",
        "description": "Save GoHighLevel settings for an owned phone number. This replaces the saved configuration for this integration; omitted configuration values do not preserve the old values. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "provider": {
                      "type": "string",
                      "description": "Integration identifier.",
                      "const": "ghl"
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Whether the saved integration is enabled."
                    }
                  },
                  "required": [
                    "ok",
                    "phone_number",
                    "provider",
                    "is_active"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "phone_number": "+12025550100",
                  "provider": "ghl",
                  "is_active": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone: The number is not valid E.164. missing_field: A required field is missing or has the wrong type. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_active": {
                    "type": "boolean",
                    "description": "Only literal false disables this configuration.",
                    "default": true
                  },
                  "agent_id": {
                    "type": "string",
                    "description": "Fallback agent ID used only when the number has no assigned agent; does not move the number."
                  },
                  "pit": {
                    "type": "string",
                    "description": "Private integration token; trimmed and never returned by GET.",
                    "writeOnly": true
                  },
                  "location_id": {
                    "type": "string",
                    "description": "Location identifier; trimmed."
                  },
                  "tags": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "description": ""
                        },
                        "description": ""
                      },
                      {
                        "type": "string",
                        "description": "Comma-separated tags."
                      }
                    ],
                    "description": "Strings are trimmed, empty entries removed and duplicates collapsed.",
                    "default": []
                  }
                },
                "required": [
                  "pit",
                  "location_id"
                ],
                "additionalProperties": false,
                "description": "Send a JSON object. Credential values must stay private."
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getGohighlevel",
        "summary": "Get GoHighLevel settings",
        "description": "Read the saved GoHighLevel settings for an owned phone number. Secret values are represented by configuration flags. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Whether the saved integration is enabled."
                    },
                    "pit_set": {
                      "type": "boolean",
                      "description": "A private token is configured."
                    },
                    "location_id": {
                      "type": "string",
                      "description": "Saved location ID or empty string."
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "Saved tag."
                      },
                      "description": ""
                    }
                  },
                  "required": [
                    "phone_number",
                    "is_active",
                    "pit_set",
                    "location_id",
                    "tags"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "phone_number": "+12025550100",
                  "is_active": true,
                  "pit_set": true,
                  "location_id": "example-location",
                  "tags": [
                    "voice"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteGohighlevel",
        "summary": "Delete GoHighLevel settings",
        "description": "Remove the saved GoHighLevel configuration scoped to this account and number. This does not disconnect the phone number. A missing configuration also returns success. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Delete request completed.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    }
                  },
                  "required": [
                    "ok",
                    "deleted",
                    "phone_number"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "deleted": true,
                  "phone_number": "+12025550100"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/slack/number/{phoneNumber}": {
      "put": {
        "operationId": "setSlack",
        "summary": "Set Slack settings",
        "description": "Save Slack settings for an owned phone number. This replaces the saved configuration for this integration; omitted configuration values do not preserve the old values. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "provider": {
                      "type": "string",
                      "description": "Integration identifier.",
                      "const": "slack"
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Whether the saved integration is enabled."
                    }
                  },
                  "required": [
                    "ok",
                    "phone_number",
                    "provider",
                    "is_active"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "phone_number": "+12025550100",
                  "provider": "slack",
                  "is_active": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone: The number is not valid E.164. missing_field: A required field is missing or has the wrong type. invalid_url: The destination URL is not accepted. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_active": {
                    "type": "boolean",
                    "description": "Only literal false disables this configuration.",
                    "default": true
                  },
                  "agent_id": {
                    "type": "string",
                    "description": "Fallback agent ID used only when the number has no assigned agent; does not move the number."
                  },
                  "webhook_url": {
                    "type": "string",
                    "description": "HTTPS incoming webhook whose host is exactly hooks.slack.com.",
                    "writeOnly": true
                  }
                },
                "required": [
                  "webhook_url"
                ],
                "additionalProperties": false,
                "description": "Send a JSON object. Credential values must stay private."
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getSlack",
        "summary": "Get Slack settings",
        "description": "Read the saved Slack settings for an owned phone number. Secret values are represented by configuration flags. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Whether the saved integration is enabled."
                    },
                    "webhook_url_set": {
                      "type": "boolean",
                      "description": "An incoming webhook is configured."
                    }
                  },
                  "required": [
                    "phone_number",
                    "is_active",
                    "webhook_url_set"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "phone_number": "+12025550100",
                  "is_active": true,
                  "webhook_url_set": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteSlack",
        "summary": "Delete Slack settings",
        "description": "Remove the saved Slack configuration scoped to this account and number. This does not disconnect the phone number. A missing configuration also returns success. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Delete request completed.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    }
                  },
                  "required": [
                    "ok",
                    "deleted",
                    "phone_number"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "deleted": true,
                  "phone_number": "+12025550100"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/precall/number/{phoneNumber}": {
      "put": {
        "operationId": "setPrecall",
        "summary": "Set pre-call gate for number",
        "description": "Set the pre-call gate setting for an owned number. A number-specific gate overrides its agent default. Clearing it restores the agent default when one exists. GET shows only the URL at this level. An unset number URL can still inherit the agent gate. This settings endpoint does not invoke the gate or validate its response.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "provider": {
                      "type": "string",
                      "description": "Integration identifier.",
                      "const": "precall"
                    }
                  },
                  "required": [
                    "ok",
                    "phone_number",
                    "provider"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "phone_number": "+12025550100",
                  "provider": "precall"
                }
              }
            }
          },
          "400": {
            "description": "missing_field: A required field is missing or has the wrong type. invalid_url: The destination URL is not accepted. invalid_phone: The number is not valid E.164. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "HTTPS destination. The handler trims the value and requires the https:// prefix."
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false,
                "description": ""
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getPrecall",
        "summary": "Get pre-call gate for number",
        "description": "Read the saved pre-call gate setting for an owned number. A number-specific gate overrides its agent default. Clearing it restores the agent default when one exists. GET shows only the URL at this level. An unset number URL can still inherit the agent gate. This settings endpoint does not invoke the gate or validate its response.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "precall_webhook_url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved URL or null. Treat destination URLs as private."
                    },
                    "is_set": {
                      "type": "boolean",
                      "description": "A URL is saved at this exact level; does not resolve inheritance."
                    }
                  },
                  "required": [
                    "phone_number",
                    "precall_webhook_url",
                    "is_set"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "phone_number": "+12025550100",
                  "precall_webhook_url": null,
                  "is_set": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deletePrecall",
        "summary": "Clear pre-call gate for number",
        "description": "Clear the saved pre-call gate setting for an owned number. A number-specific gate overrides its agent default. Clearing it restores the agent default when one exists. GET shows only the URL at this level. An unset number URL can still inherit the agent gate. This settings endpoint does not invoke the gate or validate its response.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Delete request completed.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    }
                  },
                  "required": [
                    "ok",
                    "deleted",
                    "phone_number"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "deleted": true,
                  "phone_number": "+12025550100"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/precall/agent/{agentId}": {
      "put": {
        "operationId": "setPrecallAgent",
        "summary": "Set pre-call gate for agent",
        "description": "Set the pre-call gate setting for an owned agent. This is the default for numbers on the agent; a number-specific gate takes precedence. GET shows only the URL at this level. An unset number URL can still inherit the agent gate. This settings endpoint does not invoke the gate or validate its response.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned agent identifier."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "agent_id": {
                      "type": "string",
                      "description": "Owned agent identifier."
                    },
                    "provider": {
                      "type": "string",
                      "description": "Integration identifier.",
                      "const": "precall"
                    }
                  },
                  "required": [
                    "ok",
                    "agent_id",
                    "provider"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "agent_id": "example-agent",
                  "provider": "precall"
                }
              }
            }
          },
          "400": {
            "description": "missing_field: A required field is missing or has the wrong type. invalid_url: The destination URL is not accepted. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "HTTPS destination. The handler trims the value and requires the https:// prefix."
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false,
                "description": ""
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getPrecallAgent",
        "summary": "Get pre-call gate for agent",
        "description": "Read the saved pre-call gate setting for an owned agent. This is the default for numbers on the agent; a number-specific gate takes precedence. GET shows only the URL at this level. An unset number URL can still inherit the agent gate. This settings endpoint does not invoke the gate or validate its response.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned agent identifier."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agent_id": {
                      "type": "string",
                      "description": "Owned agent identifier."
                    },
                    "precall_webhook_url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved URL or null. Treat destination URLs as private."
                    },
                    "is_set": {
                      "type": "boolean",
                      "description": "A URL is saved at this exact level; does not resolve inheritance."
                    }
                  },
                  "required": [
                    "agent_id",
                    "precall_webhook_url",
                    "is_set"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "agent_id": "example-agent",
                  "precall_webhook_url": null,
                  "is_set": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deletePrecallAgent",
        "summary": "Clear pre-call gate for agent",
        "description": "Clear the saved pre-call gate setting for an owned agent. This is the default for numbers on the agent; a number-specific gate takes precedence. GET shows only the URL at this level. An unset number URL can still inherit the agent gate. This settings endpoint does not invoke the gate or validate its response.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned agent identifier."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Delete request completed.",
                      "const": true
                    },
                    "agent_id": {
                      "type": "string",
                      "description": "Owned agent identifier."
                    }
                  },
                  "required": [
                    "ok",
                    "deleted",
                    "agent_id"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "deleted": true,
                  "agent_id": "example-agent"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/web-calls/number/{phoneNumber}": {
      "put": {
        "operationId": "setWebCalls",
        "summary": "Set web calls",
        "description": "Set the web calls setting for an owned number. This controls the saved number switch for website voice calls. Reading or changing the switch does not start a call. The GET response reports the saved number flag, not the full effective website availability. Agent settings and service availability can still prevent a website call. The website Web agent must also be on. Read phone-number details for web_calls_effective; account, agent and billing checks still apply.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "web_calls_enabled": {
                      "type": "boolean",
                      "description": "The saved number switch."
                    }
                  },
                  "required": [
                    "ok",
                    "phone_number",
                    "web_calls_enabled"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "phone_number": "+12025550100",
                  "web_calls_enabled": false
                }
              }
            }
          },
          "400": {
            "description": "missing_field: A required field is missing or has the wrong type. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "description": "Required boolean; true enables and false disables the saved number switch."
                  }
                },
                "required": [
                  "enabled"
                ],
                "additionalProperties": false,
                "description": ""
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getWebCalls",
        "summary": "Get web calls",
        "description": "Read the saved web calls setting for an owned number. This controls the saved number switch for website voice calls. Reading or changing the switch does not start a call. The GET response reports the saved number flag, not the full effective website availability. Agent settings and service availability can still prevent a website call. The website Web agent must also be on. Read phone-number details for web_calls_effective; account, agent and billing checks still apply.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "web_calls_enabled": {
                      "type": "boolean",
                      "description": "Saved number switch."
                    }
                  },
                  "required": [
                    "phone_number",
                    "web_calls_enabled"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "phone_number": "+12025550100",
                  "web_calls_enabled": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWebCalls",
        "summary": "Clear web calls",
        "description": "Clear the saved web calls setting for an owned number. This controls the saved number switch for website voice calls. Reading or changing the switch does not start a call. The GET response reports the saved number flag, not the full effective website availability. Agent settings and service availability can still prevent a website call. The website Web agent must also be on. Read phone-number details for web_calls_effective; account, agent and billing checks still apply.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "web_calls_enabled": {
                      "type": "boolean",
                      "description": "Disabled.",
                      "const": false
                    }
                  },
                  "required": [
                    "ok",
                    "phone_number",
                    "web_calls_enabled"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "phone_number": "+12025550100",
                  "web_calls_enabled": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/calcom/number/{phoneNumber}": {
      "put": {
        "operationId": "setCalcom",
        "summary": "Set Cal.com settings",
        "description": "Save Cal.com settings for an owned phone number. This replaces the saved configuration for this integration; omitted configuration values do not preserve the old values. Per-number calendar settings override agent settings. A conflict with another booking calendar is checked only after number ownership. This endpoint does not connect or disconnect other integrations. Start Google Calendar authorisation through POST /v1/integrations/google-calendar/number/{phoneNumber}/connect and open the returned URL for the calendar owner. HTTP 409 booking_provider_conflict refuses a competing calendar before saving. The error identifies the connected provider in details.connected_provider. Number connections and the agent-level fallback are both checked; changing is_active does not bypass that guard. Number-level message pattern: `CALENDAR is already connected to NUMBER. Only one booking calendar can be connected to a number at a time - the AI would be given both sets of booking tools and would silently use only one. Disconnect CALENDAR first, then connect Cal.com.` Agent-level message pattern: `CALENDAR is already connected to this agent, which covers every number on it. Only one booking calendar can be active at a time. Disconnect CALENDAR first, then connect Cal.com.` CALENDAR and NUMBER are replaced with the connected calendar label and owned number.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "provider": {
                      "type": "string",
                      "description": "Integration identifier.",
                      "const": "calcom"
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Whether the saved integration is enabled."
                    }
                  },
                  "required": [
                    "ok",
                    "phone_number",
                    "provider",
                    "is_active"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "phone_number": "+12025550100",
                  "provider": "calcom",
                  "is_active": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone: The number is not valid E.164. missing_field: A required field is missing or has the wrong type. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "409": {
            "description": "booking_provider_conflict: Another booking calendar is connected to this number or its agent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "examples": {
                  "booking_provider_conflict": {
                    "summary": "Another calendar is connected (illustrative owned number)",
                    "value": {
                      "error": {
                        "type": "conflict",
                        "code": "booking_provider_conflict",
                        "message": "Google Calendar is already connected to +12025550123. Only one booking calendar can be connected to a number at a time - the AI would be given both sets of booking tools and would silently use only one. Disconnect Google Calendar first, then connect Cal.com.",
                        "doc_url": "https://docs.nixflex.com/errors/booking_provider_conflict",
                        "details": {
                          "connected_provider": "gcal"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_active": {
                    "type": "boolean",
                    "description": "Only literal false disables this configuration.",
                    "default": true
                  },
                  "agent_id": {
                    "type": "string",
                    "description": "Fallback agent ID used only when the number has no assigned agent; does not move the number."
                  },
                  "api_key": {
                    "type": "string",
                    "description": "Calendar API credential; trimmed and never returned by GET.",
                    "writeOnly": true
                  },
                  "username": {
                    "type": "string",
                    "description": "Calendar username; trimmed."
                  },
                  "event_slug": {
                    "type": "string",
                    "description": "Calendar event slug; trimmed."
                  },
                  "default_timezone": {
                    "type": "string",
                    "description": "Calendar time zone.",
                    "default": "Europe/London"
                  }
                },
                "required": [
                  "api_key",
                  "username",
                  "event_slug"
                ],
                "additionalProperties": false,
                "description": "Send a JSON object. Credential values must stay private."
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getCalcom",
        "summary": "Get Cal.com settings",
        "description": "Read the saved Cal.com settings for an owned phone number. Secret values are represented by configuration flags.  Start Google Calendar authorisation through POST /v1/integrations/google-calendar/number/{phoneNumber}/connect and open the returned URL for the calendar owner.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "is_active": {
                      "type": "boolean",
                      "description": "Whether the saved integration is enabled."
                    },
                    "username": {
                      "type": "string",
                      "description": "Saved username or empty string."
                    },
                    "event_slug": {
                      "type": "string",
                      "description": "Saved event slug or empty string."
                    },
                    "default_timezone": {
                      "type": "string",
                      "description": "Saved time zone or empty string."
                    },
                    "api_key_set": {
                      "type": "boolean",
                      "description": "A calendar credential is configured; never the credential itself."
                    }
                  },
                  "required": [
                    "phone_number",
                    "is_active",
                    "username",
                    "event_slug",
                    "default_timezone",
                    "api_key_set"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "phone_number": "+12025550100",
                  "is_active": true,
                  "username": "example-team",
                  "event_slug": "consultation",
                  "default_timezone": "Europe/London",
                  "api_key_set": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteCalcom",
        "summary": "Delete Cal.com settings",
        "description": "Remove the saved Cal.com configuration scoped to this account and number. This does not disconnect the phone number. A missing configuration also returns success.  Start Google Calendar authorisation through POST /v1/integrations/google-calendar/number/{phoneNumber}/connect and open the returned URL for the calendar owner.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Delete request completed.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    }
                  },
                  "required": [
                    "ok",
                    "deleted",
                    "phone_number"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "deleted": true,
                  "phone_number": "+12025550100"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/custom-functions/number/{phoneNumber}": {
      "post": {
        "operationId": "createCustomFunction",
        "summary": "Create a custom function",
        "description": "Create one function for an owned number. Each number can have at most 15 functions; names must be unique for that number. Headers are private and never returned by the list route. Timeout inputs are parsed and clamped; the stored range is 1,000–45,000 ms. A supplied falsey description becomes an empty string, falsey headers become an empty object, falsey parameters restore the default schema, and falsey speak_during clears the phrase.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "id": {
                      "type": "string",
                      "description": "Function identifier."
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "name": {
                      "type": "string",
                      "description": "Saved function name."
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "phone_number",
                    "name"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "id": "11111111-1111-4111-8111-111111111111",
                  "phone_number": "+12025550100",
                  "name": "lookup_booking"
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone: The number is not valid E.164. invalid_url: The destination URL is not accepted. invalid_name: The function name is invalid. invalid_method: The HTTP method is not accepted. limit_reached: The number already has 15 functions. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "409": {
            "description": "duplicate_function: Another function on this number uses that name.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Lowercase snake_case function name.",
                    "pattern": "^[a-z][a-z0-9_]*$",
                    "maxLength": 64
                  },
                  "description": {
                    "type": "string",
                    "description": "Description supplied to the agent.",
                    "default": ""
                  },
                  "url": {
                    "type": "string",
                    "description": "HTTPS destination; required on create."
                  },
                  "method": {
                    "type": "string",
                    "description": "Uppercased before validation.",
                    "enum": [
                      "GET",
                      "POST",
                      "PUT",
                      "PATCH",
                      "DELETE"
                    ],
                    "default": "POST"
                  },
                  "headers": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Private HTTP headers. GET returns only has_headers.",
                    "default": {},
                    "writeOnly": true
                  },
                  "parameters": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Function parameter JSON schema.",
                    "default": {
                      "type": "object",
                      "properties": {}
                    }
                  },
                  "speak_during": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Optional phrase; a falsey value clears it.",
                    "default": null
                  },
                  "timeout_ms": {
                    "type": "integer",
                    "description": "Parsed as an integer and clamped to 1,000–45,000 ms. Zero or nonnumeric values fall back to 5,000.",
                    "default": 5000
                  },
                  "is_active": {
                    "type": "boolean",
                    "description": "Only literal false disables the function.",
                    "default": true
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "additionalProperties": false,
                "description": ""
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listCustomFunctions",
        "summary": "List custom functions",
        "description": "Read up to 15 saved custom functions for this account and number. No matching rows returns an empty list; the handler does not separately prove number ownership. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "functions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Function identifier."
                          },
                          "name": {
                            "type": "string",
                            "description": "Saved name."
                          },
                          "description": {
                            "type": "string",
                            "description": "Saved description."
                          },
                          "method": {
                            "type": "string",
                            "description": "Saved HTTP method."
                          },
                          "url": {
                            "type": "string",
                            "description": "Saved destination; keep it private."
                          },
                          "parameters": {
                            "type": "object",
                            "additionalProperties": true,
                            "description": "JSON object; nested properties are supplied by your integration."
                          },
                          "speak_during": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved phrase."
                          },
                          "timeout_ms": {
                            "type": "integer",
                            "description": "Saved timeout in milliseconds."
                          },
                          "is_active": {
                            "type": "boolean",
                            "description": "Saved enabled flag."
                          },
                          "has_headers": {
                            "type": "boolean",
                            "description": "Private headers exist; header values are never returned."
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "description",
                          "method",
                          "url",
                          "parameters",
                          "speak_during",
                          "timeout_ms",
                          "is_active",
                          "has_headers"
                        ],
                        "additionalProperties": false,
                        "description": ""
                      },
                      "description": "At most 15 functions; no cursor.",
                      "maxItems": 15
                    }
                  },
                  "required": [
                    "phone_number",
                    "functions"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "phone_number": "+12025550100",
                  "functions": []
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/integrations/custom-functions/number/{phoneNumber}/{id}": {
      "patch": {
        "operationId": "updateCustomFunction",
        "summary": "Update a custom function",
        "description": "Change only supplied fields of one owned custom function. Omitted fields keep their saved values; this does not create a missing function. Headers are private and never returned by the list route. Timeout inputs are parsed and clamped; the stored range is 1,000–45,000 ms. A supplied falsey description becomes an empty string, falsey headers become an empty object, falsey parameters restore the default schema, and falsey speak_during clears the phrase.",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Custom function ID returned by create or list for this number."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "id": {
                      "type": "string",
                      "description": "Function identifier."
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    },
                    "name": {
                      "type": "string",
                      "description": "Saved function name."
                    }
                  },
                  "required": [
                    "ok",
                    "id",
                    "phone_number",
                    "name"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "id": "11111111-1111-4111-8111-111111111111",
                  "phone_number": "+12025550100",
                  "name": "lookup_booking"
                }
              }
            }
          },
          "400": {
            "description": "invalid_phone: The number is not valid E.164. invalid_url: The destination URL is not accepted. invalid_name: The function name is invalid. invalid_method: The HTTP method is not accepted. no_fields: No recognised updatable fields were supplied. invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching owned resource or saved configuration was found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "409": {
            "description": "duplicate_function: Another function on this number uses that name.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Lowercase snake_case function name.",
                    "pattern": "^[a-z][a-z0-9_]*$",
                    "maxLength": 64
                  },
                  "description": {
                    "type": "string",
                    "description": "Description supplied to the agent."
                  },
                  "url": {
                    "type": "string",
                    "description": "HTTPS destination; required on create."
                  },
                  "method": {
                    "type": "string",
                    "description": "Uppercased before validation.",
                    "enum": [
                      "GET",
                      "POST",
                      "PUT",
                      "PATCH",
                      "DELETE"
                    ]
                  },
                  "headers": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Private HTTP headers. GET returns only has_headers.",
                    "writeOnly": true
                  },
                  "parameters": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Function parameter JSON schema."
                  },
                  "speak_during": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Optional phrase; a falsey value clears it."
                  },
                  "timeout_ms": {
                    "type": "integer",
                    "description": "Parsed as an integer and clamped to 1,000–45,000 ms. Zero or nonnumeric values fall back to 5,000."
                  },
                  "is_active": {
                    "type": "boolean",
                    "description": "Only literal false disables the function."
                  }
                },
                "additionalProperties": false,
                "description": "",
                "minProperties": 1
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteCustomFunction",
        "summary": "Delete a custom function",
        "description": "Remove one custom function scoped to the account, number and function ID. A missing matching row also returns success. ",
        "tags": [
          "Integration settings"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned E.164 number. URL-encode the leading plus sign."
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Custom function ID returned by create or list for this number."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Request succeeded.",
                      "const": true
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "Delete request completed.",
                      "const": true
                    },
                    "id": {
                      "type": "string",
                      "description": "Requested function ID."
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "Owned phone number."
                    }
                  },
                  "required": [
                    "ok",
                    "deleted",
                    "id",
                    "phone_number"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "ok": true,
                  "deleted": true,
                  "id": "11111111-1111-4111-8111-111111111111",
                  "phone_number": "+12025550100"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "500": {
            "description": "server_error: The result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        }
      }
    },
    "/phone-numbers/{phoneNumber}/callers/{callerNumber}": {
      "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": {
                      "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",
                                "null"
                              ],
                              "maxLength": 120,
                              "description": "Full name - first and last."
                            },
                            "email": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "email",
                              "maxLength": 120
                            },
                            "phone": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 40,
                              "description": "A contact number other than the one they call from."
                            },
                            "location": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 120,
                              "description": "Free text - city, area or postal code."
                            },
                            "reference_id": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 64,
                              "description": "An account, order or booking reference the caller uses."
                            },
                            "preference": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 200,
                              "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."
                            }
                          }
                        }
                      },
                      "required": [
                        "phone_number",
                        "caller_number",
                        "context"
                      ]
                    }
                  },
                  "required": [
                    "caller"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "examples": {
                  "caller_not_found": {
                    "summary": "caller_not_found",
                    "value": {
                      "error": {
                        "type": "not_found",
                        "code": "caller_not_found",
                        "message": "No caller record for +12025550101 on +12025550123.",
                        "doc_url": "https://docs.nixflex.com/errors/caller_not_found",
                        "details": {}
                      }
                    }
                  },
                  "phone_number_not_found": {
                    "summary": "phone_number_not_found",
                    "value": {
                      "error": {
                        "type": "not_found",
                        "code": "phone_number_not_found",
                        "message": "Phone number +12025550123 is not on this account.",
                        "doc_url": "https://docs.nixflex.com/errors/phone_number_not_found",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "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": "+12025550123"
            }
          },
          {
            "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": "+12025550101"
            }
          }
        ]
      },
      "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": {
                "type": "object",
                "description": "Send at least one field. Omitted fields keep their value; null removes a field.",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 120,
                    "description": "Full name - first and last."
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "email",
                    "maxLength": 120
                  },
                  "phone": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40,
                    "description": "A contact number other than the one they call from."
                  },
                  "location": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 120,
                    "description": "Free text - city, area or postal code."
                  },
                  "reference_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64,
                    "description": "An account, order or booking reference the caller uses."
                  },
                  "preference": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200,
                    "example": "prefers morning appointments"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "caller": {
                      "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",
                                "null"
                              ],
                              "maxLength": 120,
                              "description": "Full name - first and last."
                            },
                            "email": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "email",
                              "maxLength": 120
                            },
                            "phone": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 40,
                              "description": "A contact number other than the one they call from."
                            },
                            "location": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 120,
                              "description": "Free text - city, area or postal code."
                            },
                            "reference_id": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 64,
                              "description": "An account, order or booking reference the caller uses."
                            },
                            "preference": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 200,
                              "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."
                            }
                          }
                        }
                      },
                      "required": [
                        "phone_number",
                        "caller_number",
                        "context"
                      ]
                    }
                  },
                  "required": [
                    "caller"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "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": "+12025550123"
            }
          },
          {
            "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": "+12025550101"
            }
          }
        ]
      },
      "delete": {
        "tags": [
          "Caller context"
        ],
        "summary": "Delete caller context",
        "description": "Delete the complete caller-context record for one caller on one account-owned business number. This removes both customer-supplied and engine-learned context in that record. Use E.164 numbers for both path values. The route removes whitespace and adds + when missing; it does not enforce a numeric length limit. This operation does not erase the caller’s call records, recordings, or context on other business numbers. Later conversations or imports can create new context.",
        "operationId": "deleteCallerContext",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned business number. Use E.164 and encode it as one URL path segment."
            },
            "description": "Owned business number. Use E.164 and encode it as one URL path segment."
          },
          {
            "name": "callerNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Caller whose context is scoped to this business number. Use E.164."
            },
            "description": "Caller whose context is scoped to this business number. Use E.164."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Normalized business number."
                    },
                    "caller_number": {
                      "type": "string",
                      "description": "Normalized caller number."
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "True after deleting the context record.",
                      "const": true
                    }
                  },
                  "required": [
                    "phone_number",
                    "caller_number",
                    "deleted"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "phone_number": "+12025550100",
                  "caller_number": "+12025550101",
                  "deleted": true
                }
              }
            }
          },
          "400": {
            "description": "missing_field: A business or caller number is missing. Supply both path values.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "phone_number_not_found: The business number is not owned by this account. Use an owned business number. caller_not_found: No caller-context record exists for this pair. Check the scope; after an uncertain delete, absence may confirm it succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "database_error: Reading or deleting the record failed. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/phone-numbers/{phoneNumber}/callers/import": {
      "post": {
        "tags": [
          "Caller context"
        ],
        "summary": "Import caller context",
        "description": "Import customer-supplied context for callers on one account-owned business number. Each row merges supplied fields into that caller’s saved record; omitted fields stay unchanged. Use a business number that belongs to the authenticated account. Each caller row must supply or clear at least one of the six context fields. Numbers used as field values are converted to text before length checks. An empty string is ignored; use null to clear a field. Duplicate caller rows are applied in order, so later supplied values win. All rows are validated before writing, but storage writes are sequential and are not atomic: a database failure can leave earlier rows saved. The error message identifies progress; read affected callers before retrying. Top-level extra fields are ignored; unknown fields inside a row are refused.",
        "operationId": "importCallerContext",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned business number. Use E.164 and encode it as one URL path segment."
            },
            "description": "Owned business number. Use E.164 and encode it as one URL path segment."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "Normalized business number."
                    },
                    "imported": {
                      "type": "integer",
                      "description": "Number of rows written, not unique callers.",
                      "minimum": 1,
                      "maximum": 1000
                    }
                  },
                  "required": [
                    "phone_number",
                    "imported"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "phone_number": "+12025550100",
                  "imported": 1
                }
              }
            }
          },
          "400": {
            "description": "invalid_body: The callers array is missing or empty. Send one to 1,000 caller objects. too_many_rows: More than 1,000 rows were supplied. Split the import into bounded requests. missing_field: A caller row fails the field rules above. Correct the row and field named in the message before resending. invalid_field: A caller row fails the field rules above. Correct the row and field named in the message before resending. field_too_long: A caller row fails the field rules above. Correct the row and field named in the message before resending. invalid_email: A caller row fails the field rules above. Correct the row and field named in the message before resending. unknown_field: A caller row fails the field rules above. Correct the row and field named in the message before resending. engine_only_field: A caller row fails the field rules above. Correct the row and field named in the message before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "phone_number_not_found: The business number is not owned by this account. Use an owned business number.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "database_error: A read or write failed; earlier rows may be saved. Read affected records and reconcile before any repeat.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "callers": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "caller_number": {
                          "type": "string",
                          "description": "Caller identifier. Use E.164. Whitespace is removed and + is added when missing; the route does not enforce a numeric length limit."
                        },
                        "name": {
                          "type": [
                            "string",
                            "number",
                            "null"
                          ],
                          "description": "Up to 120 characters after conversion to text and trimming. Null clears; empty text is ignored; omitted keeps the saved value."
                        },
                        "email": {
                          "type": [
                            "string",
                            "number",
                            "null"
                          ],
                          "description": "Up to 120 characters after conversion to text and trimming. Null clears; empty text is ignored; omitted keeps the saved value. Nonempty email must have a local part, @, domain and dot."
                        },
                        "phone": {
                          "type": [
                            "string",
                            "number",
                            "null"
                          ],
                          "description": "Up to 40 characters after conversion to text and trimming. Null clears; empty text is ignored; omitted keeps the saved value."
                        },
                        "location": {
                          "type": [
                            "string",
                            "number",
                            "null"
                          ],
                          "description": "Up to 120 characters after conversion to text and trimming. Null clears; empty text is ignored; omitted keeps the saved value."
                        },
                        "reference_id": {
                          "type": [
                            "string",
                            "number",
                            "null"
                          ],
                          "description": "Up to 64 characters after conversion to text and trimming. Null clears; empty text is ignored; omitted keeps the saved value."
                        },
                        "preference": {
                          "type": [
                            "string",
                            "number",
                            "null"
                          ],
                          "description": "Up to 200 characters after conversion to text and trimming. Null clears; empty text is ignored; omitted keeps the saved value."
                        }
                      },
                      "required": [
                        "caller_number"
                      ],
                      "description": "At least one supplied or cleared context field is required. Fields last_call and open_item are engine-only.",
                      "additionalProperties": false
                    },
                    "description": "Caller rows to validate and then write in order.",
                    "minItems": 1,
                    "maxItems": 1000
                  }
                },
                "required": [
                  "callers"
                ],
                "description": "",
                "additionalProperties": true
              },
              "example": {
                "callers": [
                  {
                    "caller_number": "+12025550101",
                    "name": "Example customer",
                    "reference_id": "example-001"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/account/retention": {
      "get": {
        "tags": [
          "Account and keys"
        ],
        "summary": "Get account retention",
        "description": "Read the account retention default for new agents. Existing agents keep their saved retention settings; use Update an agent to change one agent. No path, query or body fields are required. A new account defaults to 90 days if no account retention default has been saved.",
        "operationId": "getAccountRetention",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "call_retention_days": {
                      "type": "integer",
                      "description": "Saved account default: 90, 30, 7, 1 or 0 days. Zero means delete eligible content after each call.",
                      "enum": [
                        90,
                        30,
                        7,
                        1,
                        0
                      ]
                    },
                    "applies_to": {
                      "type": "string",
                      "description": "Only new agents inherit this default.",
                      "const": "new_agents"
                    },
                    "processing_enabled": {
                      "type": "boolean",
                      "description": "Whether the retention processing feature is enabled. This does not confirm that a particular record has been erased."
                    }
                  },
                  "required": [
                    "call_retention_days",
                    "applies_to",
                    "processing_enabled"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "call_retention_days": 90,
                  "applies_to": "new_agents",
                  "processing_enabled": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "retention_unavailable: The saved retention default could not be read. Retry a bounded read after recovery; do not assume a default from the failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/organisation/name": {
      "patch": {
        "operationId": "renameOrganisation",
        "summary": "Rename an organisation",
        "description": "Set the business name shown for this organisation. Only the Owner personal session or the organisation API key can rename it. ",
        "tags": [
          "Organisation"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "Saved trimmed business name."
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "additionalProperties": false,
                  "description": ""
                },
                "example": {
                  "name": "Example team"
                }
              }
            }
          },
          "400": {
            "description": "invalid_json: The JSON body could not be parsed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The personal session is invalid or expired. unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The current personal role does not allow this action. membership_revoked: The personal membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "not_found: Organisation routes are not enabled on this service.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "409": {
            "description": "invalid_business_name: The trimmed name is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          },
          "503": {
            "description": "organisation_unavailable: The organisation action could not be confirmed. auth_unavailable: The personal session could not be verified.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error category."
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Safe explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL."
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "additionalProperties": false,
                      "description": ""
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false,
                  "description": ""
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Trimmed business name, 2–100 characters; control characters are rejected.",
                    "minLength": 2,
                    "maxLength": 100
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false,
                "description": ""
              }
            }
          }
        }
      }
    },
    "/keys/activity": {
      "get": {
        "tags": [
          "Account and keys"
        ],
        "summary": "Get key activity",
        "description": "Read a single snapshot of retained API request activity for the authenticated account. This is request activity, separate from organisation audit events and call usage. Counts cover retained request logs. Logging happens after responses and is asynchronous, so the request fetching this page may appear only in a later snapshot. Responses use Cache-Control: no-store.",
        "operationId": "getKeyActivity",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "UTC reporting period.",
              "enum": [
                "today",
                "7d"
              ],
              "default": "today"
            },
            "description": "UTC reporting period."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "period": {
                      "type": "string",
                      "description": "Selected UTC reporting period.",
                      "enum": [
                        "today",
                        "7d"
                      ]
                    },
                    "timezone": {
                      "type": "string",
                      "description": "Reporting time zone.",
                      "const": "UTC"
                    },
                    "requests": {
                      "type": "integer",
                      "description": "Retained requests in the chosen period.",
                      "minimum": 0
                    },
                    "errors": {
                      "type": "integer",
                      "description": "Retained error responses in the chosen period.",
                      "minimum": 0
                    },
                    "requests_today": {
                      "type": "integer",
                      "description": "Retained requests since the current UTC midnight.",
                      "minimum": 0
                    },
                    "errors_today": {
                      "type": "integer",
                      "description": "Retained error responses since the current UTC midnight.",
                      "minimum": 0
                    },
                    "day_start": {
                      "type": "string",
                      "description": "Current UTC day start.",
                      "format": "date-time"
                    },
                    "period_start": {
                      "type": "string",
                      "description": "Beginning of the selected reporting interval.",
                      "format": "date-time"
                    },
                    "as_of": {
                      "type": "string",
                      "description": "Snapshot time for these counts.",
                      "format": "date-time"
                    },
                    "last_used_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Last retained request time, or null.",
                      "format": "date-time"
                    },
                    "top_endpoints": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "method": {
                            "type": "string",
                            "description": "HTTP method."
                          },
                          "endpoint": {
                            "type": "string",
                            "description": "Recorded endpoint label."
                          },
                          "requests": {
                            "type": "integer",
                            "description": "Retained request count.",
                            "minimum": 0
                          }
                        },
                        "required": [
                          "method",
                          "endpoint",
                          "requests"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": "Up to five busiest endpoint/method pairs.",
                      "maxItems": 5
                    }
                  },
                  "required": [
                    "period",
                    "timezone",
                    "requests",
                    "errors",
                    "requests_today",
                    "errors_today",
                    "day_start",
                    "period_start",
                    "as_of",
                    "last_used_at",
                    "top_endpoints"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "period": "today",
                  "timezone": "UTC",
                  "requests": 12,
                  "errors": 1,
                  "requests_today": 12,
                  "errors_today": 1,
                  "day_start": "2026-11-01T00:00:00.000Z",
                  "period_start": "2026-11-01T00:00:00.000Z",
                  "as_of": "2026-11-01T12:00:00.000Z",
                  "last_used_at": "2026-11-01T11:59:00.000Z",
                  "top_endpoints": [
                    {
                      "method": "GET",
                      "endpoint": "/v1/agents",
                      "requests": 12
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_period: The period is not today or 7d. Use one of the two documented values.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "key_activity_unavailable: A complete activity snapshot could not be confirmed. Retry a bounded read later; do not substitute zero counts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/voices": {
      "get": {
        "tags": [
          "Voices"
        ],
        "summary": "List voices",
        "description": "List the voices visible to this account. Compatibility is calculated for the optional agent context; catalog availability can change before a call. Native language matches sort first, then matching locale, display name, and voice key. Compatibility context changes selectable; it does not remove every incompatible voice from the list. Keep filters unchanged while following next_cursor. Stop at null. The server does not return total_in_scope. Accent language, locale and label can each be null; keep unknown metadata as null.",
        "operationId": "listVoices",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Supported fixed language code. multi is invalid here; use agent_language for that context."
            },
            "description": "Supported fixed language code. multi is invalid here; use agent_language for that context."
          },
          {
            "name": "gender",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional gender filter.",
              "enum": [
                "male",
                "female",
                "unknown"
              ]
            },
            "description": "Optional gender filter."
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Ordering preference, not a strict filter."
            },
            "description": "Ordering preference, not a strict filter."
          },
          {
            "name": "agent_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional owned agent whose saved language provides the compatibility context. Ignored when agent_language is supplied."
            },
            "description": "Optional owned agent whose saved language provides the compatibility context. Ignored when agent_language is supplied."
          },
          {
            "name": "agent_language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional supported language code or multi for a draft agent. Takes precedence over agent_id."
            },
            "description": "Optional supported language code or multi for a draft agent. Takes precedence over agent_id."
          },
          {
            "name": "availability",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "all includes temporarily unavailable/unavailable voices. Any other supplied value follows the active behaviour.",
              "default": "active"
            },
            "description": "all includes temporarily unavailable/unavailable voices. Any other supplied value follows the active behaviour."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "The handler parses an integer and clamps it to 1–100. Missing, zero or unparseable values use 50.",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "The handler parses an integer and clamps it to 1–100. Missing, zero or unparseable values use 50."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Opaque next_cursor from the previous page. Keep the same account and filters."
            },
            "description": "Opaque next_cursor from the previous page. Keep the same account and filters."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "voice_key": {
                            "type": "string",
                            "description": "Stable neutral catalog identifier; use this value when selecting a voice."
                          },
                          "displayName": {
                            "type": "string",
                            "description": "Display label, not an identifier."
                          },
                          "gender": {
                            "type": "string",
                            "description": "Catalog gender label.",
                            "enum": [
                              "male",
                              "female",
                              "unknown"
                            ]
                          },
                          "nativeLanguage": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Native language code, when known."
                          },
                          "locale": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Locale label, when known."
                          },
                          "accents": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "language": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Accent language. Null when not supplied in the catalog."
                                },
                                "locale": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Accent locale."
                                },
                                "label": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "Neutral accent label. Null when not supplied in the catalog."
                                }
                              },
                              "required": [
                                "language",
                                "locale",
                                "label"
                              ],
                              "description": "",
                              "additionalProperties": false
                            },
                            "description": "Available accent labels."
                          },
                          "languages": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "description": "Approved language code."
                            },
                            "description": "Languages approved for this voice."
                          },
                          "origin": {
                            "type": "string",
                            "description": "Standard catalog or a connection belonging to this account.",
                            "enum": [
                              "standard",
                              "connected"
                            ]
                          },
                          "availability": {
                            "type": "string",
                            "description": "Current catalog availability.",
                            "enum": [
                              "active",
                              "temporarily_unavailable",
                              "unavailable"
                            ]
                          },
                          "selectable": {
                            "type": "boolean",
                            "description": "Whether a new selection is compatible with the supplied agent context."
                          },
                          "incompatibilityReason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Reason when not selectable: voice_unavailable, voice_temporarily_unavailable, no_approved_languages, native_language_not_in_multi_set or language_not_approved. These are response values, not HTTP errors."
                          },
                          "previewLanguage": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Preview language, or null when no preview exists."
                          },
                          "previewStatus": {
                            "type": "string",
                            "description": "Preview state; none when no preview is available."
                          },
                          "previewUrl": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Preview URL when present. Null does not imply that the voice is unavailable."
                          }
                        },
                        "required": [
                          "voice_key",
                          "displayName",
                          "gender",
                          "nativeLanguage",
                          "locale",
                          "accents",
                          "languages",
                          "origin",
                          "availability",
                          "selectable",
                          "incompatibilityReason",
                          "previewLanguage",
                          "previewStatus",
                          "previewUrl"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": "Visible voices on this page."
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Continuation cursor, or null at the end. No total count is returned."
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "voice_key": "00000000-0000-4000-8000-000000000001",
                      "displayName": "Example voice",
                      "gender": "female",
                      "nativeLanguage": "en",
                      "locale": "en-GB",
                      "accents": [],
                      "languages": [
                        "en"
                      ],
                      "origin": "standard",
                      "availability": "active",
                      "selectable": true,
                      "incompatibilityReason": null,
                      "previewLanguage": null,
                      "previewStatus": "none",
                      "previewUrl": null
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "invalid_gender: The gender filter is unsupported. Use male, female or unknown. invalid_language: The language filter is invalid or multi. Use a supported fixed language code. invalid_agent_language: The draft agent language is invalid. Use a supported language code or multi. agent_not_found: The agent context was not found for this account. Use an owned agent ID or agent_language. invalid_cursor: The cursor is malformed or belongs to another account/filter. Restart with the intended filters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "cursor_expired: The catalog revision changed. Restart at the first page and deduplicate by voice_key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "catalog_unavailable: The catalog is not loaded. Retry the read after a short wait.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/voices/{voice_key}": {
      "get": {
        "tags": [
          "Voices"
        ],
        "summary": "Get a voice",
        "description": "Read a voice visible to this account and its compatibility with an optional agent language. A successful read can return selectable: false; read the reason before using the voice. agent_language takes precedence over agent_id. Without either, selectable reflects availability and approved languages, not a particular agent. A fixed-language agent needs approval for that language; a multi-language agent uses its server-derived language set. Preview absence is separate from availability. Accent language, locale and label can each be null; keep unknown metadata as null.",
        "operationId": "getVoice",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "voice_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Voice key returned by List voices. Lookup is case-insensitive."
            },
            "description": "Voice key returned by List voices. Lookup is case-insensitive."
          },
          {
            "name": "agent_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional owned agent whose saved language provides the compatibility context. Ignored when agent_language is supplied."
            },
            "description": "Optional owned agent whose saved language provides the compatibility context. Ignored when agent_language is supplied."
          },
          {
            "name": "agent_language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional supported language code or multi for a draft agent. Takes precedence over agent_id."
            },
            "description": "Optional supported language code or multi for a draft agent. Takes precedence over agent_id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "voice_key": {
                      "type": "string",
                      "description": "Stable neutral catalog identifier; use this value when selecting a voice."
                    },
                    "displayName": {
                      "type": "string",
                      "description": "Display label, not an identifier."
                    },
                    "gender": {
                      "type": "string",
                      "description": "Catalog gender label.",
                      "enum": [
                        "male",
                        "female",
                        "unknown"
                      ]
                    },
                    "nativeLanguage": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Native language code, when known."
                    },
                    "locale": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Locale label, when known."
                    },
                    "accents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "language": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Accent language. Null when not supplied in the catalog."
                          },
                          "locale": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Accent locale."
                          },
                          "label": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Neutral accent label. Null when not supplied in the catalog."
                          }
                        },
                        "required": [
                          "language",
                          "locale",
                          "label"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": "Available accent labels."
                    },
                    "languages": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "Approved language code."
                      },
                      "description": "Languages approved for this voice."
                    },
                    "origin": {
                      "type": "string",
                      "description": "Standard catalog or a connection belonging to this account.",
                      "enum": [
                        "standard",
                        "connected"
                      ]
                    },
                    "availability": {
                      "type": "string",
                      "description": "Current catalog availability.",
                      "enum": [
                        "active",
                        "temporarily_unavailable",
                        "unavailable"
                      ]
                    },
                    "selectable": {
                      "type": "boolean",
                      "description": "Whether a new selection is compatible with the supplied agent context."
                    },
                    "incompatibilityReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Reason when not selectable: voice_unavailable, voice_temporarily_unavailable, no_approved_languages, native_language_not_in_multi_set or language_not_approved. These are response values, not HTTP errors."
                    },
                    "previewLanguage": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Preview language, or null when no preview exists."
                    },
                    "previewStatus": {
                      "type": "string",
                      "description": "Preview state; none when no preview is available."
                    },
                    "previewUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Preview URL when present. Null does not imply that the voice is unavailable."
                    }
                  },
                  "required": [
                    "voice_key",
                    "displayName",
                    "gender",
                    "nativeLanguage",
                    "locale",
                    "accents",
                    "languages",
                    "origin",
                    "availability",
                    "selectable",
                    "incompatibilityReason",
                    "previewLanguage",
                    "previewStatus",
                    "previewUrl"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "voice_key": "00000000-0000-4000-8000-000000000001",
                  "displayName": "Example voice",
                  "gender": "female",
                  "nativeLanguage": "en",
                  "locale": "en-GB",
                  "accents": [],
                  "languages": [
                    "en"
                  ],
                  "origin": "standard",
                  "availability": "active",
                  "selectable": true,
                  "incompatibilityReason": null,
                  "previewLanguage": null,
                  "previewStatus": "none",
                  "previewUrl": null
                }
              }
            }
          },
          "400": {
            "description": "invalid_agent_language: The agent language context is invalid. Use a supported code or multi. agent_not_found: The supplied agent context could not be read for this account. Use an owned agent ID or a draft language.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "voice_not_found: The voice is unknown or not visible to this account. Select a key from this account’s catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "catalog_unavailable: The catalog is not loaded. Retry the read after recovery.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/agent-inbox/{channel}/{number}": {
      "get": {
        "operationId": "get_agent_inbox_channel_number_",
        "summary": "List inbox conversations",
        "description": "List conversations for one owned number and channel. Read-only listing does not mark messages as read. Unknown query fields are refused. Boolean query values must be the literal strings true or false. period and since are mutually exclusive. Sort order is last_at descending then thread_key ascending. There is no cursor; continue by offset while needed, recognising that incoming messages can move rows between pages. archived_new and unread_total count conversations, not messages. Requests return Cache-Control: no-store.",
        "tags": [
          "Agent inbox"
        ],
        "parameters": [
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Conversation channel.",
              "enum": [
                "sms",
                "web"
              ]
            }
          },
          {
            "name": "number",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "International number with + and digits; no spaces.",
              "pattern": "^\\+[1-9][0-9]{6,14}$"
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "false selects unarchived conversations; true selects archived only.",
              "default": false
            }
          },
          {
            "name": "unread",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "true selects unread conversations; false includes both read and unread.",
              "default": false
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Literal case-insensitive search across message text, thread key and visitor name/phone.",
              "default": "",
              "maxLength": 160
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Only conversations whose last message is at or after this timestamp. Do not combine with period.",
              "format": "date-time"
            }
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "UTC calendar range: today, or the last N calendar dates including today; all has no time floor.",
              "enum": [
                "all",
                "today",
                "7",
                "30",
                "90"
              ],
              "default": "all"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Conversation page size.",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Offset in the filtered list.",
              "minimum": 0,
              "maximum": 10000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "conversations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "thread_key": {
                            "type": "string",
                            "description": "Opaque thread key."
                          },
                          "last_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "msg_count": {
                            "type": "integer",
                            "description": "Conversation message count."
                          },
                          "unread_count": {
                            "type": "integer",
                            "description": "Unread incoming message count."
                          },
                          "archived": {
                            "type": "boolean",
                            "description": "Archived state."
                          },
                          "visits": {
                            "type": "integer",
                            "description": "Distinct visits, minimum one."
                          },
                          "visitor_name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Latest visitor name when present."
                          },
                          "visitor_phone": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Latest visitor phone when present."
                          },
                          "matched": {
                            "type": "boolean",
                            "description": "Whether this conversation matches the search."
                          },
                          "last_message": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Latest message content."
                          }
                        },
                        "required": [
                          "thread_key",
                          "last_at",
                          "msg_count",
                          "unread_count",
                          "archived",
                          "visits",
                          "visitor_name",
                          "visitor_phone",
                          "matched",
                          "last_message"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": ""
                    },
                    "total": {
                      "type": "integer",
                      "description": "Filtered conversations across all pages."
                    },
                    "archived_new": {
                      "type": "integer",
                      "description": "Archived conversations with unread messages, regardless of the current filters."
                    },
                    "unread_total": {
                      "type": "integer",
                      "description": "Unarchived conversations with unread messages, regardless of current filters."
                    }
                  },
                  "required": [
                    "conversations",
                    "total",
                    "archived_new",
                    "unread_total"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "conversations": [],
                  "total": 0,
                  "archived_new": 0,
                  "unread_total": 0
                }
              }
            }
          },
          "400": {
            "description": "invalid_inbox_request: A path, query, body or settings value is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "inbox_not_found: The number or thread is unavailable to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "agent_inbox_disabled: The inbox feature is disabled. inbox_unavailable: The inbox read or write could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/agent-inbox/{channel}/{number}/thread/{thread}": {
      "get": {
        "operationId": "get_agent_inbox_channel_number_thread_thread_",
        "summary": "Read an inbox thread",
        "description": "Read retained messages in one owned inbox conversation. The newest page is selected first and returned in chronological order; this read does not mark messages as read. Use both created_at and id from the oldest message in the returned page to request older messages. Rows are selected newest-first with an ID tie-break, then returned oldest-first within the selected page. With SMS, thread is the contact key; with web, it is the session key from the list response. URL-encode either.\n\nAn owned number with no matching messages can return 200 and an empty list. Retention can remove content between reads. read_version covers the entire thread, not only the returned page: acknowledge it only if your application intends to mark all messages through that version read. Requests return Cache-Control: no-store.",
        "tags": [
          "Agent inbox"
        ],
        "parameters": [
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Conversation channel.",
              "enum": [
                "sms",
                "web"
              ]
            }
          },
          {
            "name": "number",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "International number with + and digits; no spaces.",
              "pattern": "^\\+[1-9][0-9]{6,14}$"
            }
          },
          {
            "name": "thread",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque thread key from the conversation list. URL-encode it.",
              "minLength": 1,
              "maxLength": 160
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Messages per page.",
              "default": 100,
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Oldest returned created_at for the next older page; supply before_id too.",
              "format": "date-time"
            }
          },
          {
            "name": "before_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Oldest returned message ID paired with before. Web IDs must contain 1–19 digits.",
              "maxLength": 80
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Message ID; use verbatim in the before_id cursor."
                          },
                          "thread_key": {
                            "type": "string",
                            "description": "Conversation key."
                          },
                          "content": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Retained message content."
                          },
                          "created_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "incoming": {
                            "type": "boolean",
                            "description": "Incoming visitor or customer message."
                          },
                          "inbox_version": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Per-message sequence when tracked; use the string read_version for acknowledgements."
                          },
                          "visit_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Web visit ID; null for SMS."
                          },
                          "visitor_name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Visitor label when present."
                          },
                          "visitor_phone": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Visitor phone when present."
                          },
                          "visitor_fields": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "items": {
                              "type": "object",
                              "properties": {},
                              "description": "Saved web contact field evidence.",
                              "additionalProperties": true
                            },
                            "description": "Web messages only; up to nine saved fields.",
                            "maxItems": 9
                          },
                          "knowledge_given": {
                            "description": "Optional saved outgoing knowledge evidence when available. This additive data does not change thread pagination.",
                            "type": [
                              "object",
                              "array",
                              "null"
                            ],
                            "additionalProperties": true
                          }
                        },
                        "required": [
                          "id",
                          "thread_key",
                          "content",
                          "created_at",
                          "incoming",
                          "inbox_version",
                          "visit_id",
                          "visitor_name",
                          "visitor_phone"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": ""
                    },
                    "read_version": {
                      "type": "string",
                      "description": "Maximum tracked version across the whole thread, including messages outside this page. Opaque decimal string; default 0."
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "More older messages remain before this page boundary."
                    }
                  },
                  "required": [
                    "messages",
                    "read_version",
                    "has_more"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "messages": [],
                  "read_version": "0",
                  "has_more": false
                }
              }
            }
          },
          "400": {
            "description": "invalid_inbox_request: A path, query, body or settings value is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "inbox_not_found: The number or thread is unavailable to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "agent_inbox_disabled: The inbox feature is disabled. inbox_unavailable: The inbox read or write could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "patch_agent_inbox_channel_number_thread_thread_",
        "summary": "Update an inbox thread",
        "description": "Change an owned conversation’s archive state or acknowledge messages through a known read version. This does not delete content or extend retention. Use the read_version string returned by a thread read. Decimal numeric input is also accepted but strings avoid precision loss. Versions beyond received messages are refused. Read acknowledgements only advance; an older acknowledgement cannot mark later arrivals as read. A missing conversation is 404 inbox_not_found even though reading it may return an empty list. Archiving does not change retention. Requests return Cache-Control: no-store.",
        "tags": [
          "Agent inbox"
        ],
        "parameters": [
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Conversation channel.",
              "enum": [
                "sms",
                "web"
              ]
            }
          },
          {
            "name": "number",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "International number with + and digits; no spaces.",
              "pattern": "^\\+[1-9][0-9]{6,14}$"
            }
          },
          {
            "name": "thread",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque thread key from the conversation list. URL-encode it.",
              "minLength": 1,
              "maxLength": 160
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Update confirmed.",
                      "const": true
                    },
                    "archived": {
                      "type": "boolean",
                      "description": "Current archive state."
                    }
                  },
                  "required": [
                    "ok",
                    "archived"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "archived": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_inbox_request: A path, query, body or settings value is invalid. invalid_json: Invalid JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "inbox_not_found: The number or thread is unavailable to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request exceeds the JSON body limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "agent_inbox_disabled: The inbox feature is disabled. inbox_unavailable: The inbox read or write could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "archived": {
                    "type": "boolean",
                    "description": "Set true to archive or false to unarchive. Omitted leaves state unchanged."
                  },
                  "read_version": {
                    "type": "string",
                    "description": "Opaque decimal revision. Keep as a string to avoid precision loss.",
                    "pattern": "^[0-9]{1,18}$"
                  }
                },
                "description": "Supply at least one field. Unknown fields and null are refused.",
                "additionalProperties": false,
                "minProperties": 1
              },
              "example": {
                "archived": true
              }
            }
          }
        }
      }
    },
    "/agent-inbox/features": {
      "get": {
        "operationId": "get_agent_inbox_features",
        "summary": "Check inbox availability",
        "description": "Read whether the agent inbox feature is enabled on this service. This check remains available when inbox operations are disabled. ",
        "tags": [
          "Agent inbox"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enabled": {
                      "type": "boolean",
                      "description": "Current inbox feature flag."
                    }
                  },
                  "required": [
                    "enabled"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "enabled": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/agent-inbox/numbers": {
      "get": {
        "operationId": "get_agent_inbox_numbers",
        "summary": "List inbox numbers",
        "description": "List owned numbers available to the inbox and active agent labels. Pending number imports are excluded; both API and dashboard number sources can appear. Numbers are ordered by phone_number ascending. Increase offset by 100 while has_more is true, up to the offset limit. Agent labels are a separate list capped at 1,000 and have no pagination field here. Requests return Cache-Control: no-store.",
        "tags": [
          "Agent inbox"
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Skip this many numbers; fixed page size 100.",
              "default": 0,
              "minimum": 0,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "numbers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "phone_number": {
                            "type": "string",
                            "description": "International number with + and digits; no spaces.",
                            "pattern": "^\\+[1-9][0-9]{6,14}$"
                          },
                          "agent_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Assigned agent ID."
                          },
                          "source": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved source."
                          },
                          "sms_prompt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "SMS instructions."
                          },
                          "web_prompt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Website instructions."
                          },
                          "sms_reply_enabled": {
                            "type": [
                              "boolean",
                              "null"
                            ],
                            "description": "SMS reply setting."
                          },
                          "web_agent_enabled": {
                            "type": [
                              "boolean",
                              "null"
                            ],
                            "description": "Web chat setting."
                          },
                          "web_calls_enabled": {
                            "type": [
                              "boolean",
                              "null"
                            ],
                            "description": "Website voice setting."
                          }
                        },
                        "required": [
                          "phone_number",
                          "agent_id",
                          "source",
                          "sms_prompt",
                          "web_prompt",
                          "sms_reply_enabled",
                          "web_agent_enabled",
                          "web_calls_enabled"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": ""
                    },
                    "agents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "agent_id": {
                            "type": "string",
                            "description": "Active agent ID."
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Agent label."
                          }
                        },
                        "required": [
                          "agent_id",
                          "name"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": "At most 1,000 active agents, ordered by agent_id."
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "True when the number page contains exactly 100 rows; another page may be empty."
                    }
                  },
                  "required": [
                    "numbers",
                    "agents",
                    "has_more"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "numbers": [],
                  "agents": [],
                  "has_more": false
                }
              }
            }
          },
          "400": {
            "description": "invalid_inbox_request: A path, query, body or settings value is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "inbox_not_found: The number or thread is unavailable to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "agent_inbox_disabled: The inbox feature is disabled. inbox_unavailable: The inbox read or write could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/agent-inbox/retention": {
      "get": {
        "operationId": "get_agent_inbox_retention",
        "summary": "Read inbox retention",
        "description": "Read the account retention default and inbox cleanup availability. Include a number to resolve its assigned agent’s web-message retention policy. Only number is accepted as a query field. URL-encode + in a query value. Without number, web_days is null rather than the account default. Zero days means cleanup on the next cleanup run after reply, not an immediate response-time deletion guarantee. Archiving does not extend retention. Requests return Cache-Control: no-store.",
        "tags": [
          "Agent inbox"
        ],
        "parameters": [
          {
            "name": "number",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "International number with + and digits; no spaces.",
              "pattern": "^\\+[1-9][0-9]{6,14}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "call_retention_days": {
                      "type": "integer",
                      "description": "Account retention default, 90 when unset."
                    },
                    "web_days": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Effective agent or account web days when number is supplied; null without number."
                    },
                    "web_expiry_confirmed": {
                      "type": "boolean",
                      "description": "Web cleanup database prerequisites are confirmed."
                    },
                    "applies_to": {
                      "type": "string",
                      "description": "Policy scope.",
                      "const": "new_messages_agent_policy"
                    },
                    "legacy_web_policy": {
                      "type": "string",
                      "description": "Legacy-message fallback.",
                      "const": "account_policy_at_creation_or_90_days"
                    },
                    "zero_days_means": {
                      "type": "string",
                      "description": "Zero-day cleanup timing.",
                      "const": "next_cleanup_after_reply"
                    },
                    "archive_changes_retention": {
                      "type": "boolean",
                      "description": "Archiving does not change retention.",
                      "const": false
                    },
                    "sms_days": {
                      "type": "integer",
                      "description": "SMS retention days.",
                      "const": 90
                    },
                    "sms_processing_enabled": {
                      "type": "boolean",
                      "description": "SMS cleanup processing is enabled."
                    },
                    "web_processing_enabled": {
                      "type": "boolean",
                      "description": "Cleanup enabled and web prerequisites confirmed."
                    }
                  },
                  "required": [
                    "call_retention_days",
                    "web_days",
                    "web_expiry_confirmed",
                    "applies_to",
                    "legacy_web_policy",
                    "zero_days_means",
                    "archive_changes_retention",
                    "sms_days",
                    "sms_processing_enabled",
                    "web_processing_enabled"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "call_retention_days": 90,
                  "web_days": null,
                  "web_expiry_confirmed": true,
                  "applies_to": "new_messages_agent_policy",
                  "legacy_web_policy": "account_policy_at_creation_or_90_days",
                  "zero_days_means": "next_cleanup_after_reply",
                  "archive_changes_retention": false,
                  "sms_days": 90,
                  "sms_processing_enabled": true,
                  "web_processing_enabled": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_inbox_request: A path, query, body or settings value is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "inbox_not_found: The number or thread is unavailable to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "agent_inbox_disabled: The inbox feature is disabled. inbox_unavailable: The inbox read or write could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/agent-web/{number}": {
      "get": {
        "operationId": "get_agent_web_number_",
        "summary": "Read web agent settings",
        "description": "Read website agent settings for one owned number, including its current revision and optional appearance configuration. Read defaults describe the displayed value, not necessarily a persisted setting. web_agent_enabled is read-only on this endpoint. The inbox feature must be enabled; responses use Cache-Control: no-store. The appearance object is null until saved. Its footer is always returned as Powered by Nixflex. Installation timestamps can be null when the widget has not been seen.",
        "tags": [
          "Web agent"
        ],
        "parameters": [
          {
            "name": "number",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "International number with + and digits; no spaces.",
              "pattern": "^\\+[1-9][0-9]{6,14}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "International number with + and digits; no spaces.",
                      "pattern": "^\\+[1-9][0-9]{6,14}$"
                    },
                    "agent_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Assigned agent."
                    },
                    "web_prompt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved website instructions."
                    },
                    "web_appearance": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "version": {
                          "type": "integer",
                          "description": "Appearance schema version.",
                          "const": 1
                        },
                        "launcher": {
                          "type": "string",
                          "description": "Launcher identifier.",
                          "pattern": "^[a-z][a-z0-9-]{0,31}$"
                        },
                        "window": {
                          "type": "string",
                          "description": "Window layout.",
                          "enum": [
                            "compact",
                            "side",
                            "centre",
                            "full"
                          ]
                        },
                        "visit": {
                          "type": "string",
                          "description": "Initial visit action.",
                          "enum": [
                            "nothing",
                            "greeting",
                            "open"
                          ]
                        },
                        "theme": {
                          "type": "string",
                          "description": "Colour theme.",
                          "enum": [
                            "dark",
                            "light"
                          ]
                        },
                        "colourMode": {
                          "type": "string",
                          "description": "Colour mode.",
                          "enum": [
                            "solid",
                            "gradient"
                          ]
                        },
                        "colour": {
                          "type": "string",
                          "description": "Primary RGB hex colour.",
                          "pattern": "^#[0-9a-fA-F]{6}$"
                        },
                        "colour2": {
                          "type": "string",
                          "description": "Secondary RGB hex colour.",
                          "pattern": "^#[0-9a-fA-F]{6}$"
                        },
                        "text": {
                          "type": "object",
                          "properties": {
                            "greeting": {
                              "type": "string",
                              "description": "Optional greeting wording.",
                              "maxLength": 500
                            },
                            "button": {
                              "type": "string",
                              "description": "Optional button wording.",
                              "maxLength": 500
                            },
                            "title": {
                              "type": "string",
                              "description": "Optional title wording.",
                              "maxLength": 500
                            },
                            "subtitle": {
                              "type": "string",
                              "description": "Optional subtitle wording.",
                              "maxLength": 500
                            },
                            "call": {
                              "type": "string",
                              "description": "Optional call wording.",
                              "maxLength": 500
                            },
                            "chat": {
                              "type": "string",
                              "description": "Optional chat wording.",
                              "maxLength": 500
                            },
                            "welcome": {
                              "type": "string",
                              "description": "Optional welcome wording.",
                              "maxLength": 500
                            },
                            "placeholder": {
                              "type": "string",
                              "description": "Optional placeholder wording.",
                              "maxLength": 500
                            },
                            "status": {
                              "type": "string",
                              "description": "Optional status wording.",
                              "maxLength": 500
                            },
                            "send": {
                              "type": "string",
                              "description": "Optional send wording.",
                              "maxLength": 500
                            },
                            "close": {
                              "type": "string",
                              "description": "Optional close wording.",
                              "maxLength": 500
                            },
                            "footer": {
                              "type": "string",
                              "description": "Always normalised to Powered by Nixflex on write and read.",
                              "maxLength": 500
                            },
                            "typing": {
                              "type": "string",
                              "description": "Optional typing wording.",
                              "maxLength": 500
                            },
                            "error": {
                              "type": "string",
                              "description": "Optional error wording.",
                              "maxLength": 500
                            },
                            "contact": {
                              "type": "string",
                              "description": "Optional contact wording.",
                              "maxLength": 500
                            },
                            "contactNote": {
                              "type": "string",
                              "description": "Optional contactNote wording.",
                              "maxLength": 500
                            },
                            "contactName": {
                              "type": "string",
                              "description": "Optional contactName wording.",
                              "maxLength": 500
                            },
                            "contactPhone": {
                              "type": "string",
                              "description": "Optional contactPhone wording.",
                              "maxLength": 500
                            },
                            "avatar": {
                              "type": "string",
                              "description": "Optional avatar wording.",
                              "maxLength": 500
                            },
                            "voiceConnecting": {
                              "type": "string",
                              "description": "Optional voiceConnecting wording.",
                              "maxLength": 500
                            },
                            "voicePrivacy": {
                              "type": "string",
                              "description": "Optional voicePrivacy wording.",
                              "maxLength": 500
                            },
                            "voiceMute": {
                              "type": "string",
                              "description": "Optional voiceMute wording.",
                              "maxLength": 500
                            },
                            "voiceUnmute": {
                              "type": "string",
                              "description": "Optional voiceUnmute wording.",
                              "maxLength": 500
                            },
                            "voiceEnd": {
                              "type": "string",
                              "description": "Optional voiceEnd wording.",
                              "maxLength": 500
                            },
                            "voiceAllow": {
                              "type": "string",
                              "description": "Optional voiceAllow wording.",
                              "maxLength": 500
                            },
                            "voiceCancel": {
                              "type": "string",
                              "description": "Optional voiceCancel wording.",
                              "maxLength": 500
                            },
                            "voiceEnded": {
                              "type": "string",
                              "description": "Optional voiceEnded wording.",
                              "maxLength": 500
                            },
                            "voiceYouEnded": {
                              "type": "string",
                              "description": "Optional voiceYouEnded wording.",
                              "maxLength": 500
                            },
                            "voiceUnavailable": {
                              "type": "string",
                              "description": "Optional voiceUnavailable wording.",
                              "maxLength": 500
                            },
                            "voiceUnavailableNote": {
                              "type": "string",
                              "description": "Optional voiceUnavailableNote wording.",
                              "maxLength": 500
                            },
                            "voiceDisabled": {
                              "type": "string",
                              "description": "Optional voiceDisabled wording.",
                              "maxLength": 500
                            },
                            "voiceInsecure": {
                              "type": "string",
                              "description": "Optional voiceInsecure wording.",
                              "maxLength": 500
                            },
                            "voiceInsecureNote": {
                              "type": "string",
                              "description": "Optional voiceInsecureNote wording.",
                              "maxLength": 500
                            },
                            "voicePermission": {
                              "type": "string",
                              "description": "Optional voicePermission wording.",
                              "maxLength": 500
                            },
                            "voicePermissionNote": {
                              "type": "string",
                              "description": "Optional voicePermissionNote wording.",
                              "maxLength": 500
                            },
                            "voiceChecking": {
                              "type": "string",
                              "description": "Optional voiceChecking wording.",
                              "maxLength": 500
                            },
                            "voiceNeeded": {
                              "type": "string",
                              "description": "Optional voiceNeeded wording.",
                              "maxLength": 500
                            },
                            "voiceBlocked": {
                              "type": "string",
                              "description": "Optional voiceBlocked wording.",
                              "maxLength": 500
                            },
                            "voiceMissing": {
                              "type": "string",
                              "description": "Optional voiceMissing wording.",
                              "maxLength": 500
                            },
                            "voiceInUse": {
                              "type": "string",
                              "description": "Optional voiceInUse wording.",
                              "maxLength": 500
                            },
                            "voiceMicError": {
                              "type": "string",
                              "description": "Optional voiceMicError wording.",
                              "maxLength": 500
                            },
                            "voiceBusy": {
                              "type": "string",
                              "description": "Optional voiceBusy wording.",
                              "maxLength": 500
                            },
                            "voiceBusyNote": {
                              "type": "string",
                              "description": "Optional voiceBusyNote wording.",
                              "maxLength": 500
                            },
                            "voiceRinging": {
                              "type": "string",
                              "description": "Optional voiceRinging wording.",
                              "maxLength": 500
                            },
                            "voiceLive": {
                              "type": "string",
                              "description": "Optional voiceLive wording.",
                              "maxLength": 500
                            },
                            "voiceError": {
                              "type": "string",
                              "description": "Optional voiceError wording.",
                              "maxLength": 500
                            },
                            "contactSave": {
                              "type": "string",
                              "description": "Optional contactSave wording.",
                              "maxLength": 500
                            },
                            "contactSavedEdit": {
                              "type": "string",
                              "description": "Optional contactSavedEdit wording.",
                              "maxLength": 500
                            },
                            "contactRequired": {
                              "type": "string",
                              "description": "Optional contactRequired wording.",
                              "maxLength": 500
                            },
                            "beforeCallStart": {
                              "type": "string",
                              "description": "Optional beforeCallStart wording.",
                              "maxLength": 500
                            },
                            "beforeCallCancel": {
                              "type": "string",
                              "description": "Optional beforeCallCancel wording.",
                              "maxLength": 500
                            }
                          },
                          "description": "Allowed wording keys; omitted keys are not automatically preserved when replacing appearance.",
                          "additionalProperties": false
                        },
                        "contactFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Built-in field or one of five custom fields.",
                                "pattern": "^(name|phone|email|order|custom_[1-5])$"
                              },
                              "label": {
                                "type": "string",
                                "description": "Nonblank label, no control characters; trimmed and raw length at most 60.",
                                "minLength": 1,
                                "maxLength": 60
                              },
                              "enabled": {
                                "type": "boolean",
                                "description": "Field enabled."
                              },
                              "required": {
                                "type": "boolean",
                                "description": "Field required."
                              },
                              "askInChat": {
                                "type": "boolean",
                                "description": "Optional request-in-chat flag. If absent, a disabled field cannot be required."
                              }
                            },
                            "required": [
                              "id",
                              "label",
                              "enabled",
                              "required"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "description": "Up to nine fields; IDs must be unique.",
                          "maxItems": 9
                        },
                        "beforeCall": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Use a contact form before a web call."
                            },
                            "message": {
                              "type": "string",
                              "description": "Before-call message.",
                              "maxLength": 500
                            },
                            "fields": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "description": "Built-in field or one of five custom fields.",
                                    "pattern": "^(name|phone|email|order|custom_[1-5])$"
                                  },
                                  "required": {
                                    "type": "boolean",
                                    "description": "Required before starting."
                                  }
                                },
                                "required": [
                                  "id",
                                  "required"
                                ],
                                "description": "",
                                "additionalProperties": false
                              },
                              "description": "Up to nine unique IDs. Each custom ID must exist in contactFields.",
                              "maxItems": 9
                            }
                          },
                          "required": [
                            "enabled",
                            "message",
                            "fields"
                          ],
                          "description": "",
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "version",
                        "launcher",
                        "window",
                        "visit",
                        "theme",
                        "colourMode",
                        "colour",
                        "colour2",
                        "text"
                      ],
                      "description": "Complete appearance value, not a nested merge. Database JSON representation must be at most 32,000 bytes.",
                      "additionalProperties": false
                    },
                    "appearance_version": {
                      "type": "integer",
                      "description": "Current appearance schema version.",
                      "const": 1
                    },
                    "web_design": {
                      "type": "integer",
                      "description": "Saved design, displayed as 1 when unset."
                    },
                    "web_color": {
                      "type": "string",
                      "description": "Saved colour, displayed as #25D366 when unset."
                    },
                    "web_name": {
                      "type": "string",
                      "description": "Saved name, displayed as empty when unset."
                    },
                    "web_chips": {
                      "type": "string",
                      "description": "Saved comma-separated questions, empty when unset."
                    },
                    "web_calls_enabled": {
                      "type": "boolean",
                      "description": "Saved voice setting, false when unset."
                    },
                    "web_agent_enabled": {
                      "type": [
                        "boolean",
                        "null"
                      ],
                      "description": "Current chat enabled setting; read-only here."
                    },
                    "revision": {
                      "type": "string",
                      "description": "Opaque decimal settings revision. Send current value in PATCH; 0 before an installation exists."
                    },
                    "install_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Public widget installation ID, not an API credential."
                    },
                    "first_seen_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved timestamp, or null.",
                      "format": "date-time"
                    },
                    "last_seen_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved timestamp, or null.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "phone_number",
                    "agent_id",
                    "web_prompt",
                    "web_appearance",
                    "appearance_version",
                    "web_design",
                    "web_color",
                    "web_name",
                    "web_chips",
                    "web_calls_enabled",
                    "web_agent_enabled",
                    "revision",
                    "install_id",
                    "first_seen_at",
                    "last_seen_at"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "phone_number": "+12025550101",
                  "agent_id": "agent_example",
                  "web_prompt": null,
                  "web_appearance": null,
                  "appearance_version": 1,
                  "web_design": 1,
                  "web_color": "#25D366",
                  "web_name": "",
                  "web_chips": "",
                  "web_calls_enabled": false,
                  "web_agent_enabled": true,
                  "revision": "0",
                  "install_id": null,
                  "first_seen_at": null,
                  "last_seen_at": null
                }
              }
            }
          },
          "400": {
            "description": "invalid_inbox_request: A path, query, body or settings value is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "inbox_not_found: The number or thread is unavailable to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "agent_inbox_disabled: The inbox feature is disabled. inbox_unavailable: The inbox read or write could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "patch_agent_web_number_",
        "summary": "Update web agent settings",
        "description": "Update website agent settings for one owned number using its current revision. A stale revision is refused so another editor’s change is preserved. Read defaults describe the displayed value, not necessarily a persisted setting. web_agent_enabled is read-only on this endpoint. The inbox feature must be enabled; responses use Cache-Control: no-store. Read this number’s settings first and preserve revision as a string. Numeric decimal revisions are also accepted, but strings avoid precision loss. An accepted change increments the revision. The entire web_appearance object is replaced when supplied: preserve the fields you intend to keep. Its footer is always Powered by Nixflex. Contact field IDs must be unique; custom before-call fields must exist in contactFields. No nested merge is performed.",
        "tags": [
          "Web agent"
        ],
        "parameters": [
          {
            "name": "number",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "International number with + and digits; no spaces.",
              "pattern": "^\\+[1-9][0-9]{6,14}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "description": "International number with + and digits; no spaces.",
                      "pattern": "^\\+[1-9][0-9]{6,14}$"
                    },
                    "agent_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Assigned agent."
                    },
                    "web_prompt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved website instructions."
                    },
                    "web_appearance": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "version": {
                          "type": "integer",
                          "description": "Appearance schema version.",
                          "const": 1
                        },
                        "launcher": {
                          "type": "string",
                          "description": "Launcher identifier.",
                          "pattern": "^[a-z][a-z0-9-]{0,31}$"
                        },
                        "window": {
                          "type": "string",
                          "description": "Window layout.",
                          "enum": [
                            "compact",
                            "side",
                            "centre",
                            "full"
                          ]
                        },
                        "visit": {
                          "type": "string",
                          "description": "Initial visit action.",
                          "enum": [
                            "nothing",
                            "greeting",
                            "open"
                          ]
                        },
                        "theme": {
                          "type": "string",
                          "description": "Colour theme.",
                          "enum": [
                            "dark",
                            "light"
                          ]
                        },
                        "colourMode": {
                          "type": "string",
                          "description": "Colour mode.",
                          "enum": [
                            "solid",
                            "gradient"
                          ]
                        },
                        "colour": {
                          "type": "string",
                          "description": "Primary RGB hex colour.",
                          "pattern": "^#[0-9a-fA-F]{6}$"
                        },
                        "colour2": {
                          "type": "string",
                          "description": "Secondary RGB hex colour.",
                          "pattern": "^#[0-9a-fA-F]{6}$"
                        },
                        "text": {
                          "type": "object",
                          "properties": {
                            "greeting": {
                              "type": "string",
                              "description": "Optional greeting wording.",
                              "maxLength": 500
                            },
                            "button": {
                              "type": "string",
                              "description": "Optional button wording.",
                              "maxLength": 500
                            },
                            "title": {
                              "type": "string",
                              "description": "Optional title wording.",
                              "maxLength": 500
                            },
                            "subtitle": {
                              "type": "string",
                              "description": "Optional subtitle wording.",
                              "maxLength": 500
                            },
                            "call": {
                              "type": "string",
                              "description": "Optional call wording.",
                              "maxLength": 500
                            },
                            "chat": {
                              "type": "string",
                              "description": "Optional chat wording.",
                              "maxLength": 500
                            },
                            "welcome": {
                              "type": "string",
                              "description": "Optional welcome wording.",
                              "maxLength": 500
                            },
                            "placeholder": {
                              "type": "string",
                              "description": "Optional placeholder wording.",
                              "maxLength": 500
                            },
                            "status": {
                              "type": "string",
                              "description": "Optional status wording.",
                              "maxLength": 500
                            },
                            "send": {
                              "type": "string",
                              "description": "Optional send wording.",
                              "maxLength": 500
                            },
                            "close": {
                              "type": "string",
                              "description": "Optional close wording.",
                              "maxLength": 500
                            },
                            "footer": {
                              "type": "string",
                              "description": "Always normalised to Powered by Nixflex on write and read.",
                              "maxLength": 500
                            },
                            "typing": {
                              "type": "string",
                              "description": "Optional typing wording.",
                              "maxLength": 500
                            },
                            "error": {
                              "type": "string",
                              "description": "Optional error wording.",
                              "maxLength": 500
                            },
                            "contact": {
                              "type": "string",
                              "description": "Optional contact wording.",
                              "maxLength": 500
                            },
                            "contactNote": {
                              "type": "string",
                              "description": "Optional contactNote wording.",
                              "maxLength": 500
                            },
                            "contactName": {
                              "type": "string",
                              "description": "Optional contactName wording.",
                              "maxLength": 500
                            },
                            "contactPhone": {
                              "type": "string",
                              "description": "Optional contactPhone wording.",
                              "maxLength": 500
                            },
                            "avatar": {
                              "type": "string",
                              "description": "Optional avatar wording.",
                              "maxLength": 500
                            },
                            "voiceConnecting": {
                              "type": "string",
                              "description": "Optional voiceConnecting wording.",
                              "maxLength": 500
                            },
                            "voicePrivacy": {
                              "type": "string",
                              "description": "Optional voicePrivacy wording.",
                              "maxLength": 500
                            },
                            "voiceMute": {
                              "type": "string",
                              "description": "Optional voiceMute wording.",
                              "maxLength": 500
                            },
                            "voiceUnmute": {
                              "type": "string",
                              "description": "Optional voiceUnmute wording.",
                              "maxLength": 500
                            },
                            "voiceEnd": {
                              "type": "string",
                              "description": "Optional voiceEnd wording.",
                              "maxLength": 500
                            },
                            "voiceAllow": {
                              "type": "string",
                              "description": "Optional voiceAllow wording.",
                              "maxLength": 500
                            },
                            "voiceCancel": {
                              "type": "string",
                              "description": "Optional voiceCancel wording.",
                              "maxLength": 500
                            },
                            "voiceEnded": {
                              "type": "string",
                              "description": "Optional voiceEnded wording.",
                              "maxLength": 500
                            },
                            "voiceYouEnded": {
                              "type": "string",
                              "description": "Optional voiceYouEnded wording.",
                              "maxLength": 500
                            },
                            "voiceUnavailable": {
                              "type": "string",
                              "description": "Optional voiceUnavailable wording.",
                              "maxLength": 500
                            },
                            "voiceUnavailableNote": {
                              "type": "string",
                              "description": "Optional voiceUnavailableNote wording.",
                              "maxLength": 500
                            },
                            "voiceDisabled": {
                              "type": "string",
                              "description": "Optional voiceDisabled wording.",
                              "maxLength": 500
                            },
                            "voiceInsecure": {
                              "type": "string",
                              "description": "Optional voiceInsecure wording.",
                              "maxLength": 500
                            },
                            "voiceInsecureNote": {
                              "type": "string",
                              "description": "Optional voiceInsecureNote wording.",
                              "maxLength": 500
                            },
                            "voicePermission": {
                              "type": "string",
                              "description": "Optional voicePermission wording.",
                              "maxLength": 500
                            },
                            "voicePermissionNote": {
                              "type": "string",
                              "description": "Optional voicePermissionNote wording.",
                              "maxLength": 500
                            },
                            "voiceChecking": {
                              "type": "string",
                              "description": "Optional voiceChecking wording.",
                              "maxLength": 500
                            },
                            "voiceNeeded": {
                              "type": "string",
                              "description": "Optional voiceNeeded wording.",
                              "maxLength": 500
                            },
                            "voiceBlocked": {
                              "type": "string",
                              "description": "Optional voiceBlocked wording.",
                              "maxLength": 500
                            },
                            "voiceMissing": {
                              "type": "string",
                              "description": "Optional voiceMissing wording.",
                              "maxLength": 500
                            },
                            "voiceInUse": {
                              "type": "string",
                              "description": "Optional voiceInUse wording.",
                              "maxLength": 500
                            },
                            "voiceMicError": {
                              "type": "string",
                              "description": "Optional voiceMicError wording.",
                              "maxLength": 500
                            },
                            "voiceBusy": {
                              "type": "string",
                              "description": "Optional voiceBusy wording.",
                              "maxLength": 500
                            },
                            "voiceBusyNote": {
                              "type": "string",
                              "description": "Optional voiceBusyNote wording.",
                              "maxLength": 500
                            },
                            "voiceRinging": {
                              "type": "string",
                              "description": "Optional voiceRinging wording.",
                              "maxLength": 500
                            },
                            "voiceLive": {
                              "type": "string",
                              "description": "Optional voiceLive wording.",
                              "maxLength": 500
                            },
                            "voiceError": {
                              "type": "string",
                              "description": "Optional voiceError wording.",
                              "maxLength": 500
                            },
                            "contactSave": {
                              "type": "string",
                              "description": "Optional contactSave wording.",
                              "maxLength": 500
                            },
                            "contactSavedEdit": {
                              "type": "string",
                              "description": "Optional contactSavedEdit wording.",
                              "maxLength": 500
                            },
                            "contactRequired": {
                              "type": "string",
                              "description": "Optional contactRequired wording.",
                              "maxLength": 500
                            },
                            "beforeCallStart": {
                              "type": "string",
                              "description": "Optional beforeCallStart wording.",
                              "maxLength": 500
                            },
                            "beforeCallCancel": {
                              "type": "string",
                              "description": "Optional beforeCallCancel wording.",
                              "maxLength": 500
                            }
                          },
                          "description": "Allowed wording keys; omitted keys are not automatically preserved when replacing appearance.",
                          "additionalProperties": false
                        },
                        "contactFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Built-in field or one of five custom fields.",
                                "pattern": "^(name|phone|email|order|custom_[1-5])$"
                              },
                              "label": {
                                "type": "string",
                                "description": "Nonblank label, no control characters; trimmed and raw length at most 60.",
                                "minLength": 1,
                                "maxLength": 60
                              },
                              "enabled": {
                                "type": "boolean",
                                "description": "Field enabled."
                              },
                              "required": {
                                "type": "boolean",
                                "description": "Field required."
                              },
                              "askInChat": {
                                "type": "boolean",
                                "description": "Optional request-in-chat flag. If absent, a disabled field cannot be required."
                              }
                            },
                            "required": [
                              "id",
                              "label",
                              "enabled",
                              "required"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "description": "Up to nine fields; IDs must be unique.",
                          "maxItems": 9
                        },
                        "beforeCall": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "type": "boolean",
                              "description": "Use a contact form before a web call."
                            },
                            "message": {
                              "type": "string",
                              "description": "Before-call message.",
                              "maxLength": 500
                            },
                            "fields": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "description": "Built-in field or one of five custom fields.",
                                    "pattern": "^(name|phone|email|order|custom_[1-5])$"
                                  },
                                  "required": {
                                    "type": "boolean",
                                    "description": "Required before starting."
                                  }
                                },
                                "required": [
                                  "id",
                                  "required"
                                ],
                                "description": "",
                                "additionalProperties": false
                              },
                              "description": "Up to nine unique IDs. Each custom ID must exist in contactFields.",
                              "maxItems": 9
                            }
                          },
                          "required": [
                            "enabled",
                            "message",
                            "fields"
                          ],
                          "description": "",
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "version",
                        "launcher",
                        "window",
                        "visit",
                        "theme",
                        "colourMode",
                        "colour",
                        "colour2",
                        "text"
                      ],
                      "description": "Complete appearance value, not a nested merge. Database JSON representation must be at most 32,000 bytes.",
                      "additionalProperties": false
                    },
                    "appearance_version": {
                      "type": "integer",
                      "description": "Current appearance schema version.",
                      "const": 1
                    },
                    "web_design": {
                      "type": "integer",
                      "description": "Saved design, displayed as 1 when unset."
                    },
                    "web_color": {
                      "type": "string",
                      "description": "Saved colour, displayed as #25D366 when unset."
                    },
                    "web_name": {
                      "type": "string",
                      "description": "Saved name, displayed as empty when unset."
                    },
                    "web_chips": {
                      "type": "string",
                      "description": "Saved comma-separated questions, empty when unset."
                    },
                    "web_calls_enabled": {
                      "type": "boolean",
                      "description": "Saved voice setting, false when unset."
                    },
                    "web_agent_enabled": {
                      "type": [
                        "boolean",
                        "null"
                      ],
                      "description": "Current chat enabled setting; read-only here."
                    },
                    "revision": {
                      "type": "string",
                      "description": "Opaque decimal settings revision. Send current value in PATCH; 0 before an installation exists."
                    },
                    "install_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Public widget installation ID, not an API credential."
                    },
                    "first_seen_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved timestamp, or null.",
                      "format": "date-time"
                    },
                    "last_seen_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Saved timestamp, or null.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "phone_number",
                    "agent_id",
                    "web_prompt",
                    "web_appearance",
                    "appearance_version",
                    "web_design",
                    "web_color",
                    "web_name",
                    "web_chips",
                    "web_calls_enabled",
                    "web_agent_enabled",
                    "revision",
                    "install_id",
                    "first_seen_at",
                    "last_seen_at"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "phone_number": "+12025550101",
                  "agent_id": "agent_example",
                  "web_prompt": null,
                  "web_appearance": null,
                  "appearance_version": 1,
                  "web_design": 1,
                  "web_color": "#25D366",
                  "web_name": "Example support",
                  "web_chips": "",
                  "web_calls_enabled": false,
                  "web_agent_enabled": true,
                  "revision": "1",
                  "install_id": "widget_example",
                  "first_seen_at": null,
                  "last_seen_at": null
                }
              }
            }
          },
          "400": {
            "description": "invalid_inbox_request: A path, query, body or settings value is invalid. web_prompt_too_long: Website instructions exceed 16,000 UTF-16 code units. invalid_json: Invalid JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "inbox_not_found: The number or thread is unavailable to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "widget_settings_changed: The submitted revision is stale.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request exceeds the JSON body limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "agent_inbox_disabled: The inbox feature is disabled. inbox_unavailable: The inbox read or write could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "revision": {
                    "type": "string",
                    "description": "Opaque decimal revision. Keep as a string to avoid precision loss.",
                    "pattern": "^[0-9]{1,18}$"
                  },
                  "settings": {
                    "type": "object",
                    "properties": {
                      "web_prompt": {
                        "type": "string",
                        "description": "Website instructions. Limit is 16,000 UTF-16 code units.",
                        "maxLength": 16000
                      },
                      "web_design": {
                        "type": "integer",
                        "description": "Earlier design choice.",
                        "minimum": 1,
                        "maximum": 10
                      },
                      "web_color": {
                        "type": "string",
                        "description": "RGB hex colour.",
                        "pattern": "^#[0-9a-fA-F]{6}$"
                      },
                      "web_name": {
                        "type": "string",
                        "description": "Website display name; empty clears to the display default.",
                        "maxLength": 80
                      },
                      "web_chips": {
                        "type": "string",
                        "description": "Comma-separated questions: at most four, each trimmed question at most 80 characters; total at most 323.",
                        "maxLength": 323
                      },
                      "web_calls_enabled": {
                        "type": "boolean",
                        "description": "Per-number website voice setting."
                      },
                      "web_appearance": {
                        "type": "object",
                        "properties": {
                          "version": {
                            "type": "integer",
                            "description": "Appearance schema version.",
                            "const": 1
                          },
                          "launcher": {
                            "type": "string",
                            "description": "Launcher identifier.",
                            "pattern": "^[a-z][a-z0-9-]{0,31}$"
                          },
                          "window": {
                            "type": "string",
                            "description": "Window layout.",
                            "enum": [
                              "compact",
                              "side",
                              "centre",
                              "full"
                            ]
                          },
                          "visit": {
                            "type": "string",
                            "description": "Initial visit action.",
                            "enum": [
                              "nothing",
                              "greeting",
                              "open"
                            ]
                          },
                          "theme": {
                            "type": "string",
                            "description": "Colour theme.",
                            "enum": [
                              "dark",
                              "light"
                            ]
                          },
                          "colourMode": {
                            "type": "string",
                            "description": "Colour mode.",
                            "enum": [
                              "solid",
                              "gradient"
                            ]
                          },
                          "colour": {
                            "type": "string",
                            "description": "Primary RGB hex colour.",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "colour2": {
                            "type": "string",
                            "description": "Secondary RGB hex colour.",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "text": {
                            "type": "object",
                            "properties": {
                              "greeting": {
                                "type": "string",
                                "description": "Optional greeting wording.",
                                "maxLength": 500
                              },
                              "button": {
                                "type": "string",
                                "description": "Optional button wording.",
                                "maxLength": 500
                              },
                              "title": {
                                "type": "string",
                                "description": "Optional title wording.",
                                "maxLength": 500
                              },
                              "subtitle": {
                                "type": "string",
                                "description": "Optional subtitle wording.",
                                "maxLength": 500
                              },
                              "call": {
                                "type": "string",
                                "description": "Optional call wording.",
                                "maxLength": 500
                              },
                              "chat": {
                                "type": "string",
                                "description": "Optional chat wording.",
                                "maxLength": 500
                              },
                              "welcome": {
                                "type": "string",
                                "description": "Optional welcome wording.",
                                "maxLength": 500
                              },
                              "placeholder": {
                                "type": "string",
                                "description": "Optional placeholder wording.",
                                "maxLength": 500
                              },
                              "status": {
                                "type": "string",
                                "description": "Optional status wording.",
                                "maxLength": 500
                              },
                              "send": {
                                "type": "string",
                                "description": "Optional send wording.",
                                "maxLength": 500
                              },
                              "close": {
                                "type": "string",
                                "description": "Optional close wording.",
                                "maxLength": 500
                              },
                              "footer": {
                                "type": "string",
                                "description": "Always normalised to Powered by Nixflex on write and read.",
                                "maxLength": 500
                              },
                              "typing": {
                                "type": "string",
                                "description": "Optional typing wording.",
                                "maxLength": 500
                              },
                              "error": {
                                "type": "string",
                                "description": "Optional error wording.",
                                "maxLength": 500
                              },
                              "contact": {
                                "type": "string",
                                "description": "Optional contact wording.",
                                "maxLength": 500
                              },
                              "contactNote": {
                                "type": "string",
                                "description": "Optional contactNote wording.",
                                "maxLength": 500
                              },
                              "contactName": {
                                "type": "string",
                                "description": "Optional contactName wording.",
                                "maxLength": 500
                              },
                              "contactPhone": {
                                "type": "string",
                                "description": "Optional contactPhone wording.",
                                "maxLength": 500
                              },
                              "avatar": {
                                "type": "string",
                                "description": "Optional avatar wording.",
                                "maxLength": 500
                              },
                              "voiceConnecting": {
                                "type": "string",
                                "description": "Optional voiceConnecting wording.",
                                "maxLength": 500
                              },
                              "voicePrivacy": {
                                "type": "string",
                                "description": "Optional voicePrivacy wording.",
                                "maxLength": 500
                              },
                              "voiceMute": {
                                "type": "string",
                                "description": "Optional voiceMute wording.",
                                "maxLength": 500
                              },
                              "voiceUnmute": {
                                "type": "string",
                                "description": "Optional voiceUnmute wording.",
                                "maxLength": 500
                              },
                              "voiceEnd": {
                                "type": "string",
                                "description": "Optional voiceEnd wording.",
                                "maxLength": 500
                              },
                              "voiceAllow": {
                                "type": "string",
                                "description": "Optional voiceAllow wording.",
                                "maxLength": 500
                              },
                              "voiceCancel": {
                                "type": "string",
                                "description": "Optional voiceCancel wording.",
                                "maxLength": 500
                              },
                              "voiceEnded": {
                                "type": "string",
                                "description": "Optional voiceEnded wording.",
                                "maxLength": 500
                              },
                              "voiceYouEnded": {
                                "type": "string",
                                "description": "Optional voiceYouEnded wording.",
                                "maxLength": 500
                              },
                              "voiceUnavailable": {
                                "type": "string",
                                "description": "Optional voiceUnavailable wording.",
                                "maxLength": 500
                              },
                              "voiceUnavailableNote": {
                                "type": "string",
                                "description": "Optional voiceUnavailableNote wording.",
                                "maxLength": 500
                              },
                              "voiceDisabled": {
                                "type": "string",
                                "description": "Optional voiceDisabled wording.",
                                "maxLength": 500
                              },
                              "voiceInsecure": {
                                "type": "string",
                                "description": "Optional voiceInsecure wording.",
                                "maxLength": 500
                              },
                              "voiceInsecureNote": {
                                "type": "string",
                                "description": "Optional voiceInsecureNote wording.",
                                "maxLength": 500
                              },
                              "voicePermission": {
                                "type": "string",
                                "description": "Optional voicePermission wording.",
                                "maxLength": 500
                              },
                              "voicePermissionNote": {
                                "type": "string",
                                "description": "Optional voicePermissionNote wording.",
                                "maxLength": 500
                              },
                              "voiceChecking": {
                                "type": "string",
                                "description": "Optional voiceChecking wording.",
                                "maxLength": 500
                              },
                              "voiceNeeded": {
                                "type": "string",
                                "description": "Optional voiceNeeded wording.",
                                "maxLength": 500
                              },
                              "voiceBlocked": {
                                "type": "string",
                                "description": "Optional voiceBlocked wording.",
                                "maxLength": 500
                              },
                              "voiceMissing": {
                                "type": "string",
                                "description": "Optional voiceMissing wording.",
                                "maxLength": 500
                              },
                              "voiceInUse": {
                                "type": "string",
                                "description": "Optional voiceInUse wording.",
                                "maxLength": 500
                              },
                              "voiceMicError": {
                                "type": "string",
                                "description": "Optional voiceMicError wording.",
                                "maxLength": 500
                              },
                              "voiceBusy": {
                                "type": "string",
                                "description": "Optional voiceBusy wording.",
                                "maxLength": 500
                              },
                              "voiceBusyNote": {
                                "type": "string",
                                "description": "Optional voiceBusyNote wording.",
                                "maxLength": 500
                              },
                              "voiceRinging": {
                                "type": "string",
                                "description": "Optional voiceRinging wording.",
                                "maxLength": 500
                              },
                              "voiceLive": {
                                "type": "string",
                                "description": "Optional voiceLive wording.",
                                "maxLength": 500
                              },
                              "voiceError": {
                                "type": "string",
                                "description": "Optional voiceError wording.",
                                "maxLength": 500
                              },
                              "contactSave": {
                                "type": "string",
                                "description": "Optional contactSave wording.",
                                "maxLength": 500
                              },
                              "contactSavedEdit": {
                                "type": "string",
                                "description": "Optional contactSavedEdit wording.",
                                "maxLength": 500
                              },
                              "contactRequired": {
                                "type": "string",
                                "description": "Optional contactRequired wording.",
                                "maxLength": 500
                              },
                              "beforeCallStart": {
                                "type": "string",
                                "description": "Optional beforeCallStart wording.",
                                "maxLength": 500
                              },
                              "beforeCallCancel": {
                                "type": "string",
                                "description": "Optional beforeCallCancel wording.",
                                "maxLength": 500
                              }
                            },
                            "description": "Allowed wording keys; omitted keys are not automatically preserved when replacing appearance.",
                            "additionalProperties": false
                          },
                          "contactFields": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "Built-in field or one of five custom fields.",
                                  "pattern": "^(name|phone|email|order|custom_[1-5])$"
                                },
                                "label": {
                                  "type": "string",
                                  "description": "Nonblank label, no control characters; trimmed and raw length at most 60.",
                                  "minLength": 1,
                                  "maxLength": 60
                                },
                                "enabled": {
                                  "type": "boolean",
                                  "description": "Field enabled."
                                },
                                "required": {
                                  "type": "boolean",
                                  "description": "Field required."
                                },
                                "askInChat": {
                                  "type": "boolean",
                                  "description": "Optional request-in-chat flag. If absent, a disabled field cannot be required."
                                }
                              },
                              "required": [
                                "id",
                                "label",
                                "enabled",
                                "required"
                              ],
                              "description": "",
                              "additionalProperties": false
                            },
                            "description": "Up to nine fields; IDs must be unique.",
                            "maxItems": 9
                          },
                          "beforeCall": {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "description": "Use a contact form before a web call."
                              },
                              "message": {
                                "type": "string",
                                "description": "Before-call message.",
                                "maxLength": 500
                              },
                              "fields": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "description": "Built-in field or one of five custom fields.",
                                      "pattern": "^(name|phone|email|order|custom_[1-5])$"
                                    },
                                    "required": {
                                      "type": "boolean",
                                      "description": "Required before starting."
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "required"
                                  ],
                                  "description": "",
                                  "additionalProperties": false
                                },
                                "description": "Up to nine unique IDs. Each custom ID must exist in contactFields.",
                                "maxItems": 9
                              }
                            },
                            "required": [
                              "enabled",
                              "message",
                              "fields"
                            ],
                            "description": "",
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "version",
                          "launcher",
                          "window",
                          "visit",
                          "theme",
                          "colourMode",
                          "colour",
                          "colour2",
                          "text"
                        ],
                        "description": "Complete appearance value, not a nested merge. Database JSON representation must be at most 32,000 bytes.",
                        "additionalProperties": false
                      }
                    },
                    "description": "At least one setting. Omitted top-level settings stay unchanged. Unknown settings are refused.",
                    "additionalProperties": false,
                    "minProperties": 1
                  }
                },
                "required": [
                  "revision",
                  "settings"
                ],
                "description": "",
                "additionalProperties": false
              },
              "example": {
                "revision": "0",
                "settings": {
                  "web_name": "Example support"
                }
              }
            }
          }
        }
      }
    },
    "/calls/batch/{id}/cancel": {
      "post": {
        "operationId": "post_calls_batch_id_cancel",
        "summary": "Cancel voice campaign",
        "description": "Cancel future work for an owned voice campaign. Calls or messages already in progress may finish. The body is unused. Cancellation does not recall accepted messages, undo completed calls, or remove contact records. A repeated cancellation can return already_terminal.",
        "tags": [
          "Voice campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Account-owned campaign identifier.",
              "minLength": 1,
              "maxLength": 100,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string",
                      "description": "Campaign ID."
                    },
                    "status": {
                      "type": "string",
                      "description": "Cancelled state.",
                      "const": "cancelled"
                    },
                    "in_progress_may_finish": {
                      "type": "boolean",
                      "description": "Already in-progress contact may still finish.",
                      "const": true
                    }
                  },
                  "required": [
                    "campaign_id",
                    "status",
                    "in_progress_may_finish"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "status": "cancelled",
                  "in_progress_may_finish": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching object belongs to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "already_terminal: The campaign already reached a terminal state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "feature_paused: This control is paused. outcome_unknown: The write result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/calls/batch/{id}/consent": {
      "post": {
        "operationId": "post_calls_batch_id_consent",
        "summary": "Record voice consent",
        "description": "Record a consent or consent-withdrawal decision for the current voice campaign policy revision. The owner confirms the selected event explicitly. confirmed must be true for either event. Omitted fields and false are refused. This endpoint does not launch a campaign or clear suppression. Recording consent can unblock otherwise eligible scheduled or running work. Missing campaigns and unconfirmed database results currently return 503 outcome_unknown.",
        "tags": [
          "Voice campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Account-owned campaign identifier.",
              "minLength": 1,
              "maxLength": 100,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string",
                      "description": "Campaign ID."
                    },
                    "recorded": {
                      "type": "boolean",
                      "description": "The decision was recorded.",
                      "const": true
                    }
                  },
                  "required": [
                    "campaign_id",
                    "recorded"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "recorded": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid. invalid_json: Invalid JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request exceeds the JSON body limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "outcome_unknown: The write result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "description": "Decision to record.",
                    "enum": [
                      "consent",
                      "consent_withdrawn"
                    ]
                  },
                  "confirmed": {
                    "type": "boolean",
                    "description": "Explicitly confirm the selected event, including withdrawal.",
                    "const": true
                  }
                },
                "required": [
                  "event",
                  "confirmed"
                ],
                "description": "",
                "additionalProperties": false
              },
              "example": {
                "event": "consent",
                "confirmed": true
              }
            }
          }
        }
      }
    },
    "/calls/batch/{id}/resume": {
      "post": {
        "operationId": "post_calls_batch_id_resume",
        "summary": "Resume voice campaign",
        "description": "Resume one bounded page of verified unattempted recipients in the current running voice campaign. This can dispatch contact and keeps the existing launch generation. The body is unused and there is no public cursor field. At most 100 verified unattempted recipients are processed per request. Only status running with a current launch claim is resumable; paused, cancelled and finished campaigns are refused. A 200 may still contain paused or held in page_result. Queued jobs still pass final permission, local-hours and capacity checks.",
        "tags": [
          "Voice campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Account-owned campaign identifier.",
              "minLength": 1,
              "maxLength": 100,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string",
                      "description": "Campaign ID."
                    },
                    "status": {
                      "type": "string",
                      "description": "Same running generation.",
                      "const": "running"
                    },
                    "page_result": {
                      "type": "object",
                      "properties": {
                        "enqueued": {
                          "type": "integer",
                          "description": "Voice jobs queued in this page."
                        },
                        "next": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Row ID of the last recipient queued by this request (at most 100 rows per request), or null when none was queued. You cannot send it back; a later resume request queues rows that are still unattempted."
                        },
                        "paused": {
                          "type": "boolean",
                          "description": "Dispatch processing is paused."
                        },
                        "held": {
                          "type": [
                            "integer",
                            "string"
                          ],
                          "description": "Held count or reason, depending on the returned branch."
                        },
                        "outcome": {
                          "type": "string",
                          "description": "SMS page outcome, such as completed, held or stopped_safety."
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Page hold or stop reason."
                        },
                        "sent": {
                          "type": "integer",
                          "description": "SMS accepted sends in this page."
                        },
                        "failed": {
                          "type": "integer",
                          "description": "SMS known failures in this page."
                        },
                        "segments": {
                          "type": "integer",
                          "description": "SMS segments in this page."
                        },
                        "campaign_done": {
                          "type": [
                            "boolean",
                            "null"
                          ],
                          "description": "Whether completion was confirmed."
                        },
                        "dispatchSafety": {
                          "type": "boolean",
                          "description": "This page stopped before its current attempted recipient."
                        },
                        "attempt_outcome": {
                          "type": "string",
                          "description": "Current attempted recipient result."
                        },
                        "attempt_sent": {
                          "type": "boolean",
                          "description": "Current attempt sent flag."
                        },
                        "attempt_charged": {
                          "type": "boolean",
                          "description": "Current attempt charged flag."
                        },
                        "attempt_safe_to_retry": {
                          "type": "boolean",
                          "description": "Applies only to the current attempt, never the whole page."
                        },
                        "safe_to_retry": {
                          "type": "boolean",
                          "description": "Whole-page replay is not safe."
                        },
                        "stop_message": {
                          "type": "string",
                          "description": "Current attempt refusal explanation."
                        },
                        "not_sent": {
                          "type": "integer",
                          "description": "Remaining recipients in the page."
                        },
                        "stop_recorded": {
                          "type": "boolean",
                          "description": "Whether the stop evidence was saved."
                        },
                        "attempted_recipient_id": {
                          "type": "string",
                          "description": "Current recipient ID."
                        }
                      },
                      "description": "Branch-specific page result; at most 100 verified unattempted rows.",
                      "additionalProperties": true
                    },
                    "safe_to_retry": {
                      "type": "boolean",
                      "description": "Do not automatically replay this response.",
                      "const": false
                    },
                    "message": {
                      "type": "string",
                      "description": "Admission explanation; inspect page_result for actual holds or sends."
                    }
                  },
                  "required": [
                    "campaign_id",
                    "status",
                    "page_result",
                    "safe_to_retry",
                    "message"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "status": "running",
                  "page_result": {
                    "enqueued": 0,
                    "next": null
                  },
                  "safe_to_retry": false,
                  "message": "Queued for final permission, local-hours and capacity checks; queued does not mean sent."
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching object belongs to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "not_resumable: Only a running campaign with a current launch claim can resume.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "feature_paused: This control is paused. outcome_unknown: The write result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/contact-hours/preview": {
      "post": {
        "operationId": "post_contact_hours_preview",
        "summary": "Preview contact hours",
        "description": "Preview recipient-local contact windows without sending calls, SMS or campaign work. The result is advisory and expires after one minute; final dispatch checks still apply. The campaign preview uses start and end as HH:mm, unlike campaign creation’s minute fields. Omitted period settings use the current policy. Unknown or ambiguous locations, holidays and unverified policy data can hold a row rather than promise a future window. Multiple possible zones must satisfy the applicable checks.\n\nnext_allowed is a bounded estimate: computation can stop for budget, horizon or missing policy data. windows describe current recipient-local-date windows, not an unlimited future schedule. allow_wider_hours only changes the preview assumption; it does not save the required campaign confirmation. The example versions and times are illustrative.",
        "tags": [
          "Contact controls"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "preview_only": {
                      "type": "boolean",
                      "description": "No contact is sent.",
                      "const": true
                    },
                    "mode": {
                      "type": "string",
                      "description": "Current preview policy mode.",
                      "enum": [
                        "global",
                        "legacy_recipient_estimate"
                      ]
                    },
                    "policy_version": {
                      "type": "string",
                      "description": "Contact policy version."
                    },
                    "runtime_timezone_version": {
                      "type": "string",
                      "description": "Runtime time-zone data version."
                    },
                    "as_of": {
                      "type": "string",
                      "description": "Server calculation time.",
                      "format": "date-time"
                    },
                    "expires_at": {
                      "type": "string",
                      "description": "One minute after as_of.",
                      "format": "date-time"
                    },
                    "agent_timezone": {
                      "type": "string",
                      "description": "Configured agent zone."
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "description": "Zero-based input row."
                          },
                          "country": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Resolved country."
                          },
                          "possible_zones": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "description": "Plausible recipient time zone."
                            },
                            "description": ""
                          },
                          "display_reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Human-display reason such as weekend or outside_hours."
                          },
                          "message": {
                            "type": "string",
                            "description": "Advisory explanation."
                          },
                          "next_allowed": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "at_utc": {
                                "type": "string",
                                "description": "Next estimated allowed time in UTC.",
                                "format": "date-time"
                              },
                              "local": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "zone": {
                                      "type": "string",
                                      "description": "IANA time zone."
                                    },
                                    "date": {
                                      "type": "string",
                                      "description": "Local calendar date."
                                    },
                                    "time": {
                                      "type": "string",
                                      "description": "Local HH:mm time."
                                    }
                                  },
                                  "required": [
                                    "zone",
                                    "date",
                                    "time"
                                  ],
                                  "description": "",
                                  "additionalProperties": false
                                },
                                "description": ""
                              }
                            },
                            "required": [
                              "at_utc",
                              "local"
                            ],
                            "description": "",
                            "additionalProperties": false
                          },
                          "next_unavailable": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Why no future estimate is available, such as budget or horizon."
                          },
                          "advisory_only": {
                            "type": "boolean",
                            "description": "Always true.",
                            "const": true
                          },
                          "local_now": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "zone": {
                                  "type": "string",
                                  "description": "IANA time zone."
                                },
                                "date": {
                                  "type": "string",
                                  "description": "Local calendar date."
                                },
                                "time": {
                                  "type": "string",
                                  "description": "Local HH:mm time."
                                }
                              },
                              "required": [
                                "zone",
                                "date",
                                "time"
                              ],
                              "description": "",
                              "additionalProperties": false
                            },
                            "description": ""
                          },
                          "hold_reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Current policy hold code."
                          },
                          "allowed_now": {
                            "type": "boolean",
                            "description": "Current time-window estimate, not permission to dispatch."
                          },
                          "windows": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "start_utc": {
                                  "type": "string",
                                  "description": "UTC window start.",
                                  "format": "date-time"
                                },
                                "end_utc": {
                                  "type": "string",
                                  "description": "UTC window end.",
                                  "format": "date-time"
                                },
                                "recipient": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "zone": {
                                        "type": "string",
                                        "description": "Recipient zone."
                                      },
                                      "start": {
                                        "type": "object",
                                        "properties": {
                                          "date": {
                                            "type": "string",
                                            "description": "Local calendar date."
                                          },
                                          "time": {
                                            "type": "string",
                                            "description": "Local HH:mm time."
                                          }
                                        },
                                        "required": [
                                          "date",
                                          "time"
                                        ],
                                        "description": "",
                                        "additionalProperties": false
                                      },
                                      "end": {
                                        "type": "object",
                                        "properties": {
                                          "date": {
                                            "type": "string",
                                            "description": "Local calendar date."
                                          },
                                          "time": {
                                            "type": "string",
                                            "description": "Local HH:mm time."
                                          }
                                        },
                                        "required": [
                                          "date",
                                          "time"
                                        ],
                                        "description": "",
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "zone",
                                      "start",
                                      "end"
                                    ],
                                    "description": "",
                                    "additionalProperties": false
                                  },
                                  "description": ""
                                },
                                "agent": {
                                  "type": "object",
                                  "properties": {
                                    "zone": {
                                      "type": "string",
                                      "description": "Agent zone."
                                    },
                                    "start": {
                                      "type": "object",
                                      "properties": {
                                        "date": {
                                          "type": "string",
                                          "description": "Local calendar date."
                                        },
                                        "time": {
                                          "type": "string",
                                          "description": "Local HH:mm time."
                                        }
                                      },
                                      "required": [
                                        "date",
                                        "time"
                                      ],
                                      "description": "",
                                      "additionalProperties": false
                                    },
                                    "end": {
                                      "type": "object",
                                      "properties": {
                                        "date": {
                                          "type": "string",
                                          "description": "Local calendar date."
                                        },
                                        "time": {
                                          "type": "string",
                                          "description": "Local HH:mm time."
                                        }
                                      },
                                      "required": [
                                        "date",
                                        "time"
                                      ],
                                      "description": "",
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "zone",
                                    "start",
                                    "end"
                                  ],
                                  "description": "",
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "start_utc",
                                "end_utc",
                                "recipient",
                                "agent"
                              ],
                              "description": "",
                              "additionalProperties": false
                            },
                            "description": ""
                          }
                        },
                        "required": [
                          "index",
                          "country",
                          "possible_zones",
                          "display_reason",
                          "message",
                          "next_allowed",
                          "next_unavailable",
                          "advisory_only",
                          "local_now",
                          "hold_reason",
                          "allowed_now",
                          "windows"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": ""
                    }
                  },
                  "required": [
                    "preview_only",
                    "mode",
                    "policy_version",
                    "runtime_timezone_version",
                    "as_of",
                    "expires_at",
                    "agent_timezone",
                    "rows"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "preview_only": true,
                  "mode": "global",
                  "policy_version": "example-version",
                  "runtime_timezone_version": "example-tz-version",
                  "as_of": "2026-11-01T12:00:00Z",
                  "expires_at": "2026-11-01T12:01:00Z",
                  "agent_timezone": "Europe/London",
                  "rows": [
                    {
                      "index": 0,
                      "country": "US",
                      "possible_zones": [
                        "America/New_York"
                      ],
                      "display_reason": "outside_hours",
                      "message": "Outside calling hours - next start time could not be confirmed",
                      "next_allowed": null,
                      "next_unavailable": "budget",
                      "advisory_only": true,
                      "local_now": [
                        {
                          "zone": "America/New_York",
                          "date": "2026-11-01",
                          "time": "07:00"
                        }
                      ],
                      "hold_reason": "outside_hours",
                      "allowed_now": false,
                      "windows": []
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_contact_preview: The preview request has an invalid shape or limit. invalid_json: Invalid JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching object belongs to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request exceeds the JSON body limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "422": {
            "description": "agent_timezone_required: The owned agent has no valid configured time zone.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "contact_preview_busy: The preview worker is busy. rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "contact_preview_unavailable: Policy or preview data could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent_id": {
                    "type": "string",
                    "description": "Owned agent with a configured valid IANA time zone.",
                    "pattern": "^[A-Za-z0-9_-]{1,64}$"
                  },
                  "recipients": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "phone": {
                          "type": "string",
                          "description": "Input number used for location estimates.",
                          "maxLength": 32
                        },
                        "country": {
                          "type": "string",
                          "description": "Optional two-letter country.",
                          "maxLength": 2
                        },
                        "timezone": {
                          "type": "string",
                          "description": "Optional recipient time zone.",
                          "maxLength": 80
                        }
                      },
                      "required": [
                        "phone"
                      ],
                      "description": "",
                      "additionalProperties": false
                    },
                    "description": "Between one and 20 recipients.",
                    "minItems": 1,
                    "maxItems": 20
                  },
                  "campaign": {
                    "type": "object",
                    "properties": {
                      "allow_wider_hours": {
                        "type": "boolean",
                        "description": "Preview assumption only; does not record permission.",
                        "default": false
                      },
                      "start": {
                        "type": "string",
                        "description": "HH:mm start; provide end too.",
                        "pattern": "^(?:[01][0-9]|2[0-3]):[0-5][0-9]$"
                      },
                      "end": {
                        "type": "string",
                        "description": "HH:mm end; must differ from start.",
                        "pattern": "^(?:[01][0-9]|2[0-3]):[0-5][0-9]$"
                      },
                      "days": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "description": "Lowercase weekday.",
                          "enum": [
                            "sun",
                            "mon",
                            "tue",
                            "wed",
                            "thu",
                            "fri",
                            "sat"
                          ]
                        },
                        "description": "Optional selected weekdays.",
                        "minItems": 1,
                        "maxItems": 7
                      },
                      "scheduled_date": {
                        "type": "string",
                        "description": "Valid calendar date in YYYY-MM-DD form.",
                        "format": "date"
                      }
                    },
                    "description": "Optional preview assumptions; unknown keys are ignored.",
                    "additionalProperties": true
                  }
                },
                "required": [
                  "agent_id",
                  "recipients"
                ],
                "description": "Unknown root fields are ignored.",
                "additionalProperties": true
              },
              "example": {
                "agent_id": "agent_example",
                "recipients": [
                  {
                    "phone": "+12025550101",
                    "country": "US",
                    "timezone": "America/New_York"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/contact-suppressions": {
      "delete": {
        "operationId": "delete_contact_suppressions",
        "summary": "Remove a contact suppression",
        "description": "Remove one explicitly removable owner-created suppression. Recipient opt-outs and entries without verified owner-removal permission remain locked. The request uses a JSON body even though the method is DELETE. Choose the exact bucket to remove; removing voice leaves any all or sms entry intact. Removing a suppression can make scheduled work eligible again; it does not grant campaign consent.",
        "tags": [
          "Contact controls"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "removed": {
                      "type": "boolean",
                      "description": "The owner entry was removed.",
                      "const": true
                    },
                    "phone_number": {
                      "type": "string",
                      "description": "International number with + and digits; no spaces.",
                      "pattern": "^\\+[1-9][0-9]{6,14}$"
                    },
                    "channel": {
                      "type": "string",
                      "description": "Removed stored bucket.",
                      "enum": [
                        "all",
                        "voice",
                        "sms"
                      ]
                    }
                  },
                  "required": [
                    "removed",
                    "phone_number",
                    "channel"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "removed": true,
                  "phone_number": "+12025550101",
                  "channel": "all"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid. invalid_json: Invalid JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching object belongs to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "suppression_locked: This entry cannot be removed through the owner API.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request exceeds the JSON body limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "feature_paused: This control is paused. outcome_unknown: The write result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone_number": {
                    "type": "string",
                    "description": "International number with + and digits; no spaces.",
                    "pattern": "^\\+[1-9][0-9]{6,14}$"
                  },
                  "channel": {
                    "type": "string",
                    "description": "Channel bucket.",
                    "enum": [
                      "all",
                      "voice",
                      "sms"
                    ],
                    "default": "all"
                  }
                },
                "required": [
                  "phone_number"
                ],
                "description": "",
                "additionalProperties": false
              },
              "example": {
                "phone_number": "+12025550101",
                "channel": "all"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_contact_suppressions",
        "summary": "List contact suppressions",
        "description": "List stored do-not-contact entries in one channel bucket. channel=all selects entries stored for all channels; it does not combine the voice and SMS buckets. Pages contain at most 200 rows in phone_number ascending order. There is no configurable limit. Nonempty pages return their last number as next_cursor even when short; pass it as after until an empty page returns null. For a full inventory, page all, voice and sms separately. Contact checks can apply an all-channel entry as well as a channel-specific entry.",
        "tags": [
          "Contact controls"
        ],
        "parameters": [
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Channel bucket.",
              "enum": [
                "all",
                "voice",
                "sms"
              ],
              "default": "all"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Continue after this E.164 number from next_cursor.",
              "pattern": "^\\+[1-9][0-9]{6,14}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "phone_number": {
                            "type": "string",
                            "description": "International number with + and digits; no spaces.",
                            "pattern": "^\\+[1-9][0-9]{6,14}$"
                          },
                          "channel": {
                            "type": "string",
                            "description": "Stored channel bucket.",
                            "enum": [
                              "all",
                              "voice",
                              "sms"
                            ]
                          },
                          "source": {
                            "type": "string",
                            "description": "Why it was suppressed, for example owner or sms_optout."
                          },
                          "created_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "removal_locked": {
                            "type": "boolean",
                            "description": "Only false for an explicitly removable owner-created entry."
                          },
                          "opted_out_message": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "For SMS opt-outs: retained text, limited to 160 code points."
                          },
                          "opted_out_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Saved timestamp, or null.",
                            "format": "date-time"
                          },
                          "opted_out_business_number": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "International number with + and digits; no spaces.",
                            "pattern": "^\\+[1-9][0-9]{6,14}$"
                          }
                        },
                        "required": [
                          "phone_number",
                          "channel",
                          "source",
                          "created_at",
                          "removal_locked"
                        ],
                        "description": "",
                        "additionalProperties": false
                      },
                      "description": ""
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "International number with + and digits; no spaces.",
                      "pattern": "^\\+[1-9][0-9]{6,14}$"
                    }
                  },
                  "required": [
                    "entries",
                    "next_cursor"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "entries": [],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Suppression entries could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "post_contact_suppressions",
        "summary": "Add contact suppressions",
        "description": "Add account-owned do-not-contact entries for future contact checks. Existing entries are retained; a new owner request cannot replace recipient opt-out evidence. Repeated values do not create duplicate entries in the same account/channel bucket. This changes future contact permission, not already accepted contact. Existing opt-outs remain enforced even if adding owner suppressions is temporarily paused.",
        "tags": [
          "Contact controls"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "added": {
                      "type": "integer",
                      "description": "New stored entries; existing matches and duplicate input rows add nothing."
                    },
                    "submitted": {
                      "type": "integer",
                      "description": "Number of submitted input rows, including duplicates."
                    },
                    "channel": {
                      "type": "string",
                      "description": "Chosen stored bucket.",
                      "enum": [
                        "all",
                        "voice",
                        "sms"
                      ]
                    }
                  },
                  "required": [
                    "added",
                    "submitted",
                    "channel"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "added": 1,
                  "submitted": 1,
                  "channel": "all"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid. invalid_json: Invalid JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request exceeds the JSON body limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "feature_paused: This control is paused. outcome_unknown: The write result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone_numbers": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "International number with + and digits; no spaces.",
                      "pattern": "^\\+[1-9][0-9]{6,14}$"
                    },
                    "description": "One to 1,000 strict E.164 numbers.",
                    "minItems": 1,
                    "maxItems": 1000
                  },
                  "channel": {
                    "type": "string",
                    "description": "Channel bucket.",
                    "enum": [
                      "all",
                      "voice",
                      "sms"
                    ],
                    "default": "all"
                  }
                },
                "required": [
                  "phone_numbers"
                ],
                "description": "",
                "additionalProperties": false
              },
              "example": {
                "phone_numbers": [
                  "+12025550101"
                ],
                "channel": "all"
              }
            }
          }
        }
      }
    },
    "/sms/campaigns/{id}/cancel": {
      "post": {
        "operationId": "post_sms_campaigns_id_cancel",
        "summary": "Cancel SMS campaign",
        "description": "Cancel future work for an owned SMS campaign. Calls or messages already in progress may finish. The body is unused. Cancellation does not recall accepted messages, undo completed calls, or remove contact records. A repeated cancellation can return already_terminal.",
        "tags": [
          "SMS campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Account-owned campaign identifier.",
              "minLength": 1,
              "maxLength": 100,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string",
                      "description": "Campaign ID."
                    },
                    "status": {
                      "type": "string",
                      "description": "Cancelled state.",
                      "const": "cancelled"
                    },
                    "in_progress_may_finish": {
                      "type": "boolean",
                      "description": "Already in-progress contact may still finish.",
                      "const": true
                    }
                  },
                  "required": [
                    "campaign_id",
                    "status",
                    "in_progress_may_finish"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "status": "cancelled",
                  "in_progress_may_finish": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching object belongs to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "already_terminal: The campaign already reached a terminal state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "feature_paused: This control is paused. outcome_unknown: The write result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/sms/campaigns/{id}/consent": {
      "post": {
        "operationId": "post_sms_campaigns_id_consent",
        "summary": "Record SMS consent",
        "description": "Record a consent or consent-withdrawal decision for the current SMS campaign policy revision. The owner confirms the selected event explicitly. confirmed must be true for either event. Omitted fields and false are refused. This endpoint does not launch a campaign or clear suppression. Recording consent can unblock otherwise eligible scheduled or running work. Missing campaigns and unconfirmed database results currently return 503 outcome_unknown.",
        "tags": [
          "SMS campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Account-owned campaign identifier.",
              "minLength": 1,
              "maxLength": 100,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string",
                      "description": "Campaign ID."
                    },
                    "recorded": {
                      "type": "boolean",
                      "description": "The decision was recorded.",
                      "const": true
                    }
                  },
                  "required": [
                    "campaign_id",
                    "recorded"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "recorded": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid. invalid_json: Invalid JSON body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "payload_too_large: The request exceeds the JSON body limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "outcome_unknown: The write result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "description": "Decision to record.",
                    "enum": [
                      "consent",
                      "consent_withdrawn"
                    ]
                  },
                  "confirmed": {
                    "type": "boolean",
                    "description": "Explicitly confirm the selected event, including withdrawal.",
                    "const": true
                  }
                },
                "required": [
                  "event",
                  "confirmed"
                ],
                "description": "",
                "additionalProperties": false
              },
              "example": {
                "event": "consent",
                "confirmed": true
              }
            }
          }
        }
      }
    },
    "/sms/campaigns/{id}/resume": {
      "post": {
        "operationId": "post_sms_campaigns_id_resume",
        "summary": "Resume SMS campaign",
        "description": "Resume one bounded page of verified unattempted recipients in the current running SMS campaign. This can dispatch contact and keeps the existing launch generation. The body is unused and there is no public cursor field. At most 100 verified unattempted recipients are processed per request. Only status running with a current launch claim is resumable; paused, cancelled and finished campaigns are refused. A 200 may still contain paused or held in page_result. Inspect page_result.outcome and dispatchSafety: a page can stop safely after earlier messages were accepted; the top-level message does not confirm sending.",
        "tags": [
          "SMS campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Account-owned campaign identifier.",
              "minLength": 1,
              "maxLength": 100,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string",
                      "description": "Campaign ID."
                    },
                    "status": {
                      "type": "string",
                      "description": "Same running generation.",
                      "const": "running"
                    },
                    "page_result": {
                      "type": "object",
                      "properties": {
                        "enqueued": {
                          "type": "integer",
                          "description": "Voice jobs queued in this page."
                        },
                        "next": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Row ID of the last recipient queued by this request (at most 100 rows per request), or null when none was queued. You cannot send it back; a later resume request queues rows that are still unattempted."
                        },
                        "paused": {
                          "type": "boolean",
                          "description": "Dispatch processing is paused."
                        },
                        "held": {
                          "type": [
                            "integer",
                            "string"
                          ],
                          "description": "Held count or reason, depending on the returned branch."
                        },
                        "outcome": {
                          "type": "string",
                          "description": "SMS page outcome, such as completed, held or stopped_safety."
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Page hold or stop reason."
                        },
                        "sent": {
                          "type": "integer",
                          "description": "SMS accepted sends in this page."
                        },
                        "failed": {
                          "type": "integer",
                          "description": "SMS known failures in this page."
                        },
                        "segments": {
                          "type": "integer",
                          "description": "SMS segments in this page."
                        },
                        "campaign_done": {
                          "type": [
                            "boolean",
                            "null"
                          ],
                          "description": "Whether completion was confirmed."
                        },
                        "dispatchSafety": {
                          "type": "boolean",
                          "description": "This page stopped before its current attempted recipient."
                        },
                        "attempt_outcome": {
                          "type": "string",
                          "description": "Current attempted recipient result."
                        },
                        "attempt_sent": {
                          "type": "boolean",
                          "description": "Current attempt sent flag."
                        },
                        "attempt_charged": {
                          "type": "boolean",
                          "description": "Current attempt charged flag."
                        },
                        "attempt_safe_to_retry": {
                          "type": "boolean",
                          "description": "Applies only to the current attempt, never the whole page."
                        },
                        "safe_to_retry": {
                          "type": "boolean",
                          "description": "Whole-page replay is not safe."
                        },
                        "stop_message": {
                          "type": "string",
                          "description": "Current attempt refusal explanation."
                        },
                        "not_sent": {
                          "type": "integer",
                          "description": "Remaining recipients in the page."
                        },
                        "stop_recorded": {
                          "type": "boolean",
                          "description": "Whether the stop evidence was saved."
                        },
                        "attempted_recipient_id": {
                          "type": "string",
                          "description": "Current recipient ID."
                        }
                      },
                      "description": "Branch-specific page result; at most 100 verified unattempted rows.",
                      "additionalProperties": true
                    },
                    "safe_to_retry": {
                      "type": "boolean",
                      "description": "Do not automatically replay this response.",
                      "const": false
                    },
                    "message": {
                      "type": "string",
                      "description": "Admission explanation; inspect page_result for actual holds or sends."
                    }
                  },
                  "required": [
                    "campaign_id",
                    "status",
                    "page_result",
                    "safe_to_retry",
                    "message"
                  ],
                  "description": "",
                  "additionalProperties": false
                },
                "example": {
                  "campaign_id": "campaign_example",
                  "status": "running",
                  "page_result": {
                    "next": null,
                    "enqueued": 0
                  },
                  "safe_to_retry": false,
                  "message": "Queued for final permission, local-hours and capacity checks; queued does not mean sent."
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The identifier or request fields are invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found: No matching object belongs to this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "not_resumable: Only a running campaign with a current launch claim can resume.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "feature_paused: This control is paused. outcome_unknown: The write result could not be confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/agents/{target}/knowledge-base": {
      "delete": {
        "operationId": "delete_agents_target_knowledge_base",
        "tags": [
          "Knowledge"
        ],
        "summary": "Delete agent knowledge",
        "description": "Revoke an agent’s live knowledge immediately and queue private-data deletion. Deletion revokes access before the job finishes. Read the deletion job until deleted and private_objects_remaining is 0. It cannot be cancelled after revocation.",
        "parameters": [
          {
            "name": "target",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned agent ID. URL-encode it as a path segment."
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. busy: Please wait for the existing knowledge jobs to finish.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  }
                },
                "required": [
                  "expected_revision"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "expected_revision": 1
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_agents_target_knowledge_base",
        "tags": [
          "Knowledge"
        ],
        "summary": "Get agent knowledge",
        "description": "Read the agent’s own knowledge base, settings and current revision. An agent without knowledge returns own:null and effective:null. Knowledge belongs only to agents; there is no number inheritance.",
        "parameters": [
          {
            "name": "target",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned agent ID. URL-encode it as a path segment."
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "mode": {
                      "type": "string",
                      "description": "",
                      "const": "own"
                    },
                    "own": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "owner": {
                          "type": "string",
                          "description": "Owning account identifier; it never grants access when sent by a caller."
                        },
                        "kind": {
                          "type": "string",
                          "description": "Knowledge belongs to an agent.",
                          "const": "agent"
                        },
                        "target": {
                          "type": "string",
                          "description": "Owning agent ID."
                        },
                        "rev": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "active": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Active published index revision, or null before publication.",
                          "format": "uuid"
                        },
                        "state": {
                          "type": "string",
                          "description": "Lifecycle state.",
                          "enum": [
                            "ready",
                            "deleting",
                            "deleted"
                          ]
                        },
                        "settings": {
                          "type": "object",
                          "properties": {
                            "channels": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "description": "Channel identifier.",
                                "enum": [
                                  "inbound",
                                  "outbound",
                                  "web_voice",
                                  "web_chat",
                                  "sms"
                                ]
                              },
                              "description": "Enabled knowledge channels. An empty list turns knowledge off for all channels.",
                              "uniqueItems": true,
                              "default": [
                                "inbound"
                              ]
                            },
                            "match": {
                              "type": "string",
                              "description": "Answer matching mode.",
                              "enum": [
                                "Strict",
                                "Normal"
                              ],
                              "default": "Strict"
                            },
                            "not_found": {
                              "type": "string",
                              "description": "Nonblank response when suitable knowledge is missing.",
                              "minLength": 1,
                              "maxLength": 500,
                              "default": "I don't have that information right now."
                            }
                          },
                          "additionalProperties": false,
                          "description": "Only channels, match and not_found may be supplied. Omitted settings retain the saved value on update."
                        },
                        "tombstones": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "subject_hash": {
                                "type": "string",
                                "description": "Normalized title digest."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              }
                            },
                            "required": [
                              "id",
                              "subject_hash",
                              "evidence"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": "Records that prevent refreshed sources restoring removed pieces."
                        },
                        "created_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "owner",
                        "kind",
                        "target",
                        "rev",
                        "active",
                        "state",
                        "settings",
                        "tombstones",
                        "created_at"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "effective": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "owner": {
                          "type": "string",
                          "description": "Owning account identifier; it never grants access when sent by a caller."
                        },
                        "kind": {
                          "type": "string",
                          "description": "Knowledge belongs to an agent.",
                          "const": "agent"
                        },
                        "target": {
                          "type": "string",
                          "description": "Owning agent ID."
                        },
                        "rev": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "active": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Active published index revision, or null before publication.",
                          "format": "uuid"
                        },
                        "state": {
                          "type": "string",
                          "description": "Lifecycle state.",
                          "enum": [
                            "ready",
                            "deleting",
                            "deleted"
                          ]
                        },
                        "settings": {
                          "type": "object",
                          "properties": {
                            "channels": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "description": "Channel identifier.",
                                "enum": [
                                  "inbound",
                                  "outbound",
                                  "web_voice",
                                  "web_chat",
                                  "sms"
                                ]
                              },
                              "description": "Enabled knowledge channels. An empty list turns knowledge off for all channels.",
                              "uniqueItems": true,
                              "default": [
                                "inbound"
                              ]
                            },
                            "match": {
                              "type": "string",
                              "description": "Answer matching mode.",
                              "enum": [
                                "Strict",
                                "Normal"
                              ],
                              "default": "Strict"
                            },
                            "not_found": {
                              "type": "string",
                              "description": "Nonblank response when suitable knowledge is missing.",
                              "minLength": 1,
                              "maxLength": 500,
                              "default": "I don't have that information right now."
                            }
                          },
                          "additionalProperties": false,
                          "description": "Only channels, match and not_found may be supplied. Omitted settings retain the saved value on update."
                        },
                        "tombstones": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "subject_hash": {
                                "type": "string",
                                "description": "Normalized title digest."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              }
                            },
                            "required": [
                              "id",
                              "subject_hash",
                              "evidence"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": "Records that prevent refreshed sources restoring removed pieces."
                        },
                        "created_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "owner",
                        "kind",
                        "target",
                        "rev",
                        "active",
                        "state",
                        "settings",
                        "tombstones",
                        "created_at"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "policy_revision": {
                      "type": "integer",
                      "description": "Compatibility value; zero for agent-only knowledge.",
                      "const": 0
                    }
                  },
                  "required": [
                    "mode",
                    "own",
                    "effective",
                    "policy_revision"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "put_agents_target_knowledge_base",
        "tags": [
          "Knowledge"
        ],
        "summary": "Set agent knowledge",
        "description": "Create the agent’s singleton knowledge base or update its settings. Creation may omit expected_revision. An existing base requires its current rev. This does not publish source text.",
        "parameters": [
          {
            "name": "target",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned agent ID. URL-encode it as a path segment."
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "mode": {
                      "type": "string",
                      "description": "",
                      "const": "own"
                    },
                    "own": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "owner": {
                          "type": "string",
                          "description": "Owning account identifier; it never grants access when sent by a caller."
                        },
                        "kind": {
                          "type": "string",
                          "description": "Knowledge belongs to an agent.",
                          "const": "agent"
                        },
                        "target": {
                          "type": "string",
                          "description": "Owning agent ID."
                        },
                        "rev": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "active": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Active published index revision, or null before publication.",
                          "format": "uuid"
                        },
                        "state": {
                          "type": "string",
                          "description": "Lifecycle state.",
                          "enum": [
                            "ready",
                            "deleting",
                            "deleted"
                          ]
                        },
                        "settings": {
                          "type": "object",
                          "properties": {
                            "channels": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "description": "Channel identifier.",
                                "enum": [
                                  "inbound",
                                  "outbound",
                                  "web_voice",
                                  "web_chat",
                                  "sms"
                                ]
                              },
                              "description": "Enabled knowledge channels. An empty list turns knowledge off for all channels.",
                              "uniqueItems": true,
                              "default": [
                                "inbound"
                              ]
                            },
                            "match": {
                              "type": "string",
                              "description": "Answer matching mode.",
                              "enum": [
                                "Strict",
                                "Normal"
                              ],
                              "default": "Strict"
                            },
                            "not_found": {
                              "type": "string",
                              "description": "Nonblank response when suitable knowledge is missing.",
                              "minLength": 1,
                              "maxLength": 500,
                              "default": "I don't have that information right now."
                            }
                          },
                          "additionalProperties": false,
                          "description": "Only channels, match and not_found may be supplied. Omitted settings retain the saved value on update."
                        },
                        "tombstones": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "subject_hash": {
                                "type": "string",
                                "description": "Normalized title digest."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              }
                            },
                            "required": [
                              "id",
                              "subject_hash",
                              "evidence"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": "Records that prevent refreshed sources restoring removed pieces."
                        },
                        "created_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "owner",
                        "kind",
                        "target",
                        "rev",
                        "active",
                        "state",
                        "settings",
                        "tombstones",
                        "created_at"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "effective": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "owner": {
                          "type": "string",
                          "description": "Owning account identifier; it never grants access when sent by a caller."
                        },
                        "kind": {
                          "type": "string",
                          "description": "Knowledge belongs to an agent.",
                          "const": "agent"
                        },
                        "target": {
                          "type": "string",
                          "description": "Owning agent ID."
                        },
                        "rev": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "active": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Active published index revision, or null before publication.",
                          "format": "uuid"
                        },
                        "state": {
                          "type": "string",
                          "description": "Lifecycle state.",
                          "enum": [
                            "ready",
                            "deleting",
                            "deleted"
                          ]
                        },
                        "settings": {
                          "type": "object",
                          "properties": {
                            "channels": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "description": "Channel identifier.",
                                "enum": [
                                  "inbound",
                                  "outbound",
                                  "web_voice",
                                  "web_chat",
                                  "sms"
                                ]
                              },
                              "description": "Enabled knowledge channels. An empty list turns knowledge off for all channels.",
                              "uniqueItems": true,
                              "default": [
                                "inbound"
                              ]
                            },
                            "match": {
                              "type": "string",
                              "description": "Answer matching mode.",
                              "enum": [
                                "Strict",
                                "Normal"
                              ],
                              "default": "Strict"
                            },
                            "not_found": {
                              "type": "string",
                              "description": "Nonblank response when suitable knowledge is missing.",
                              "minLength": 1,
                              "maxLength": 500,
                              "default": "I don't have that information right now."
                            }
                          },
                          "additionalProperties": false,
                          "description": "Only channels, match and not_found may be supplied. Omitted settings retain the saved value on update."
                        },
                        "tombstones": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "subject_hash": {
                                "type": "string",
                                "description": "Normalized title digest."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              }
                            },
                            "required": [
                              "id",
                              "subject_hash",
                              "evidence"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": "Records that prevent refreshed sources restoring removed pieces."
                        },
                        "created_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "owner",
                        "kind",
                        "target",
                        "rev",
                        "active",
                        "state",
                        "settings",
                        "tombstones",
                        "created_at"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "policy_revision": {
                      "type": "integer",
                      "description": "Compatibility value; zero for agent-only knowledge.",
                      "const": 0
                    }
                  },
                  "required": [
                    "mode",
                    "own",
                    "effective",
                    "policy_revision"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. base_limit: This account has reached its knowledge base limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "settings": {
                    "type": "object",
                    "properties": {
                      "channels": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "description": "Channel identifier.",
                          "enum": [
                            "inbound",
                            "outbound",
                            "web_voice",
                            "web_chat",
                            "sms"
                          ]
                        },
                        "description": "Enabled knowledge channels. An empty list turns knowledge off for all channels.",
                        "uniqueItems": true,
                        "default": [
                          "inbound"
                        ]
                      },
                      "match": {
                        "type": "string",
                        "description": "Answer matching mode.",
                        "enum": [
                          "Strict",
                          "Normal"
                        ],
                        "default": "Strict"
                      },
                      "not_found": {
                        "type": "string",
                        "description": "Nonblank response when suitable knowledge is missing.",
                        "minLength": 1,
                        "maxLength": 500,
                        "default": "I don't have that information right now."
                      }
                    },
                    "additionalProperties": false,
                    "description": "Only channels, match and not_found may be supplied. Omitted settings retain the saved value on update."
                  },
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  }
                },
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "settings": {
                  "channels": [
                    "inbound"
                  ],
                  "match": "Strict",
                  "not_found": "I don't have that information right now."
                }
              }
            }
          }
        }
      }
    },
    "/agents/{target}/knowledge-base/source-measure": {
      "post": {
        "operationId": "post_agents_target_knowledge_base_source_measure",
        "tags": [
          "Knowledge"
        ],
        "summary": "Measure knowledge source",
        "description": "Preview source token usage before an import without storing the source. This authenticated POST is a read-only calculation and needs no Idempotency-Key. It does not reserve capacity, call a paid model or save a file/base. Import checks totals again.\n\nRaw upload: Content-Type application/octet-stream, X-Filename, optional X-Source-Title and X-Review; replacements also require X-Expected-Revision. File maximum 10 MiB; PDF maximum 200 pages. Accept clean UTF-8 text, PDF with selectable text, or DOCX. No raw base64/path input, RTF, executable or active-content documents. Preview scan status is not publication clearance. Without a configured scanner, local_checks_only permits bounded local checks. With a configured scanner, PDF/DOCX need a clean result; clean UTF-8 text can use local checks during an outage. Infected files never bypass. Imports may wait at safety_check/safety_waiting with next_retry_at; after 24 hours scan_expired requires a new upload. Raw files are private and never downloaded; accepted storage retains extracted text.",
        "parameters": [
          {
            "name": "target",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned agent ID. URL-encode it as a path segment."
            }
          },
          {
            "name": "X-Filename",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Required for a raw upload; filename up to 200 characters. Use a genuine PDF, DOCX or UTF-8 text file.",
              "maxLength": 200
            }
          },
          {
            "name": "X-Source-Title",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional source title, at most 200 characters; defaults to filename.",
              "maxLength": 200
            }
          },
          {
            "name": "X-Review",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "For imports: exactly true requests review; other/omitted values mean false for API requests."
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tokens": {
                      "type": "integer",
                      "description": ""
                    },
                    "limit": {
                      "type": "integer",
                      "description": "",
                      "const": 20000
                    },
                    "used": {
                      "type": "integer",
                      "description": ""
                    },
                    "total_limit": {
                      "type": "integer",
                      "description": "",
                      "const": 100000
                    },
                    "projected": {
                      "type": "integer",
                      "description": ""
                    },
                    "allowed": {
                      "type": "boolean",
                      "description": ""
                    },
                    "scan_status": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "checked",
                        "local_checks_only",
                        "text_checks_only",
                        "pending",
                        "not_needed"
                      ]
                    }
                  },
                  "required": [
                    "tokens",
                    "limit",
                    "used",
                    "total_limit",
                    "projected",
                    "allowed",
                    "scan_status"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "source_limit: This source contains too much text. Split it into smaller documents. file_limit: This file is too big. Choose a file up to 10 MiB. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "wrong_type: The file contents do not match its type. Use a genuine PDF, DOCX or plain UTF-8 text file. unsupported_file: Use PDF, DOCX or plain UTF-8 text. Rich text and executable files are not accepted. unsafe_word: This Word file contains macros, embedded files or active content. Save a clean DOCX or paste the text.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "empty_file: This file is empty. Choose a file containing text. unclean_text: This file is not clean UTF-8 text. Save it as UTF-8 without binary data or hidden control characters. unsafe_file: This file failed the virus safety check. Use a clean copy or paste clean text. unsafe_pdf: This PDF contains scripts, actions or embedded files. Export a clean text-only PDF or paste the text. unsafe_word: This Word file contains macros, embedded files or active content. Save a clean DOCX or paste the text. password_pdf: This PDF is password protected. Remove the password from a copy or paste the text. scanned_pdf: This PDF has a page with no readable text. Use a text PDF, convert the scanned pages to text, or paste the text. page_limit: This PDF has more than 200 pages. Split it into smaller documents. archive_limit: This Word document expands beyond the safe size limit. Save a smaller DOCX or paste the text. unreadable: This file is damaged or could not be read safely. Save a new copy or paste the text. parse_timeout: Reading this file took too long. Try a smaller document or paste the text.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. measure_busy: Other files are being checked. Please try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet. measure_unavailable: Counting took too long. Try a smaller source or try again. scan_unavailable: Safety check in progress. We will retry automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Text up to 10 MiB of UTF-8 bytes. Empty input returns allowed:false."
                  }
                },
                "required": [
                  "text"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "text": "Appointments are available Monday to Friday."
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary",
                "description": "Raw PDF, DOCX or UTF-8 text, at most 10 MiB. Supply X-Filename. Replacement also requires X-Expected-Revision."
              }
            }
          }
        }
      }
    },
    "/agents/{target}/knowledge-base/test-sessions": {
      "post": {
        "operationId": "post_agents_target_knowledge_base_test_sessions",
        "tags": [
          "Knowledge"
        ],
        "summary": "Start knowledge test",
        "description": "Start a knowledge-only simulated test session for an agent with live knowledge. At least one approved unsuppressed topic must already be live, even for a draft preview. Number, call_purpose and training modes are refused. Up to 100 new sessions per account per day; existing-session questions are unlimited.",
        "parameters": [
          {
            "name": "target",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned agent ID. URL-encode it as a path segment."
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "owner": {
                      "type": "string",
                      "description": "Owning account ID."
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "expected_rev": {
                      "type": "integer",
                      "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                      "minimum": 1
                    },
                    "started_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "description": "",
                          "const": "knowledge"
                        },
                        "channel": {
                          "type": "string",
                          "description": "",
                          "enum": [
                            "inbound",
                            "outbound",
                            "web_voice",
                            "web_chat",
                            "sms"
                          ]
                        },
                        "draft_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "target": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "description": "",
                              "const": "agent"
                            },
                            "target": {
                              "type": "string",
                              "description": "Agent ID."
                            }
                          },
                          "required": [
                            "kind",
                            "target"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "messages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kb": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "role": {
                                "type": "string",
                                "description": "",
                                "enum": [
                                  "user",
                                  "assistant"
                                ]
                              },
                              "text": {
                                "type": "string",
                                "description": "Test conversation text."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              },
                              "selection": {
                                "type": "string",
                                "description": "",
                                "enum": [
                                  "whole_base",
                                  "search"
                                ]
                              },
                              "preview": {
                                "type": "boolean",
                                "description": ""
                              },
                              "simulated": {
                                "type": "boolean",
                                "description": "No call, text, booking or integration action runs."
                              },
                              "diagnostics": {
                                "type": "object",
                                "properties": {
                                  "mode": {
                                    "type": "string",
                                    "description": ""
                                  },
                                  "method": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": ""
                                  },
                                  "best_score": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "description": ""
                                  }
                                },
                                "additionalProperties": true,
                                "description": "API diagnostics only; these scores are not answer-correctness measurements."
                              }
                            },
                            "required": [
                              "id",
                              "role",
                              "text"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": "Latest 100 messages; questions are unlimited.",
                          "maxItems": 100
                        },
                        "state": {
                          "type": "string",
                          "description": "",
                          "enum": [
                            "active",
                            "cancelled",
                            "closed"
                          ]
                        },
                        "pending_message": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "mode",
                        "channel",
                        "draft_id",
                        "target",
                        "messages",
                        "state"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    }
                  },
                  "required": [
                    "id",
                    "owner",
                    "kb",
                    "expected_rev",
                    "started_at",
                    "data"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. knowledge_missing: Add and approve at least one topic before testing. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. session_limit: Too many test sessions today. Reuse an existing session.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "description": "",
                    "const": "knowledge",
                    "default": "knowledge"
                  },
                  "channel": {
                    "type": "string",
                    "description": "",
                    "enum": [
                      "inbound",
                      "outbound",
                      "web_voice",
                      "web_chat",
                      "sms"
                    ],
                    "default": "inbound"
                  },
                  "draft_id": {
                    "type": "string",
                    "description": "Opaque identifier. Keep it as a string.",
                    "format": "uuid"
                  }
                },
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "mode": "knowledge",
                "channel": "inbound"
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}": {
      "get": {
        "operationId": "get_knowledge_bases_kb_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Get knowledge base",
        "description": "Read a knowledge base’s settings, revision and active published index. rev is the integer used for expected_revision. active identifies the published index and can be null.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "owner": {
                      "type": "string",
                      "description": "Owning account identifier; it never grants access when sent by a caller."
                    },
                    "kind": {
                      "type": "string",
                      "description": "Knowledge belongs to an agent.",
                      "const": "agent"
                    },
                    "target": {
                      "type": "string",
                      "description": "Owning agent ID."
                    },
                    "rev": {
                      "type": "integer",
                      "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                      "minimum": 1
                    },
                    "active": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Active published index revision, or null before publication.",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "description": "Lifecycle state.",
                      "enum": [
                        "ready",
                        "deleting",
                        "deleted"
                      ]
                    },
                    "settings": {
                      "type": "object",
                      "properties": {
                        "channels": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": "Channel identifier.",
                            "enum": [
                              "inbound",
                              "outbound",
                              "web_voice",
                              "web_chat",
                              "sms"
                            ]
                          },
                          "description": "Enabled knowledge channels. An empty list turns knowledge off for all channels.",
                          "uniqueItems": true,
                          "default": [
                            "inbound"
                          ]
                        },
                        "match": {
                          "type": "string",
                          "description": "Answer matching mode.",
                          "enum": [
                            "Strict",
                            "Normal"
                          ],
                          "default": "Strict"
                        },
                        "not_found": {
                          "type": "string",
                          "description": "Nonblank response when suitable knowledge is missing.",
                          "minLength": 1,
                          "maxLength": 500,
                          "default": "I don't have that information right now."
                        }
                      },
                      "additionalProperties": false,
                      "description": "Only channels, match and not_found may be supplied. Omitted settings retain the saved value on update."
                    },
                    "tombstones": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "subject_hash": {
                            "type": "string",
                            "description": "Normalized title digest."
                          },
                          "evidence": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "source": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "segment": {
                                  "type": "integer",
                                  "description": "Source segment index."
                                },
                                "quote": {
                                  "type": "string",
                                  "description": "Original evidence text."
                                },
                                "quote_hash": {
                                  "type": "string",
                                  "description": "Digest used by a deletion record."
                                },
                                "topic_id": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "revision": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "title": {
                                  "type": "string",
                                  "description": "Title snapshot at answer time."
                                }
                              },
                              "additionalProperties": true,
                              "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                            },
                            "description": ""
                          }
                        },
                        "required": [
                          "id",
                          "subject_hash",
                          "evidence"
                        ],
                        "additionalProperties": true,
                        "description": ""
                      },
                      "description": "Records that prevent refreshed sources restoring removed pieces."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "owner",
                    "kind",
                    "target",
                    "rev",
                    "active",
                    "state",
                    "settings",
                    "tombstones",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/drafts/{id}": {
      "delete": {
        "operationId": "delete_knowledge_bases_kb_drafts_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Discard knowledge draft",
        "description": "Discard a review draft while retaining currently published knowledge. Accepted/publishing drafts cannot be discarded. An associated import job is cancelled; only an unused legacy reservation can be released.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "discarded": {
                      "type": "boolean",
                      "description": "",
                      "const": true
                    }
                  },
                  "required": [
                    "kb",
                    "discarded"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. draft_closed: This review has already been accepted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expected_draft_revision": {
                    "type": "integer",
                    "description": "Current data.edit_revision; use 0 only when absent.",
                    "minimum": 0
                  }
                },
                "required": [
                  "expected_draft_revision"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "expected_draft_revision": 0
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_knowledge_bases_kb_drafts_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Get knowledge draft",
        "description": "Read a draft without persisting repairs. Legacy normalization is projected with stable draft-scoped piece IDs; an explicit save or accept persists it. Keep the returned edit revision before editing.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "owner": {
                      "type": "string",
                      "description": "Owning account ID."
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "expected_rev": {
                      "type": "integer",
                      "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                      "minimum": 1
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "format": {
                          "type": "string",
                          "description": "Current format is pieces-v1."
                        },
                        "topics": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "title": {
                                "type": "string",
                                "description": "Displayed piece title."
                              },
                              "facts": {
                                "type": "string",
                                "description": "Piece text."
                              },
                              "questions": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": ""
                                },
                                "description": "Labels kept from manual entry or earlier imports; new imports do not generate questions."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              },
                              "manual": {
                                "type": "boolean",
                                "description": "True when manually written or corrected."
                              },
                              "valid_from": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "valid_until": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "suppressed": {
                                "type": "boolean",
                                "description": "True while an edited old piece must not be used."
                              },
                              "origin": {
                                "type": "string",
                                "description": "Optional origin marker from earlier imports."
                              },
                              "position": {
                                "type": "object",
                                "properties": {
                                  "added_at": {
                                    "type": "string",
                                    "description": "UTC timestamp.",
                                    "format": "date-time"
                                  },
                                  "source": {
                                    "type": "integer",
                                    "description": ""
                                  },
                                  "segment": {
                                    "type": "integer",
                                    "description": ""
                                  }
                                },
                                "additionalProperties": true,
                                "description": "Stable display-order metadata."
                              },
                              "page_name": {
                                "type": "string",
                                "description": "Optional source page label."
                              },
                              "title_page": {
                                "type": "string",
                                "description": "Optional label used to distinguish similar automatic titles."
                              },
                              "review_flags": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": "",
                                  "enum": [
                                    "agent_instructions",
                                    "suspicious_link",
                                    "payment_details",
                                    "sensitive_data",
                                    "website_junk",
                                    "code_example"
                                  ]
                                },
                                "description": ""
                              },
                              "check_required": {
                                "type": "boolean",
                                "description": "A flagged topic needs explicit individual approval."
                              },
                              "check_reasons": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": "Fixed plain-language review reason."
                                },
                                "description": ""
                              },
                              "check_reason": {
                                "type": "string",
                                "description": "Compatibility joined review reasons."
                              },
                              "keyterms": {
                                "type": "object",
                                "properties": {
                                  "version": {
                                    "type": "integer",
                                    "description": "Stored automatic-term format version."
                                  },
                                  "fingerprint": {
                                    "type": "string",
                                    "description": "Digest of the source text used to validate cached terms."
                                  },
                                  "terms": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "description": "Source-spelled automatic term."
                                    },
                                    "description": "Stored suggested terms."
                                  },
                                  "ranks": {
                                    "type": "object",
                                    "description": "Keys are normalized terms; each value records score (1–4) and essential (boolean).",
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "score": {
                                          "type": "integer",
                                          "description": "Stored importance.",
                                          "minimum": 1,
                                          "maximum": 4
                                        },
                                        "essential": {
                                          "type": "boolean",
                                          "description": "Central identity marker."
                                        }
                                      },
                                      "required": [
                                        "score",
                                        "essential"
                                      ],
                                      "additionalProperties": true,
                                      "description": ""
                                    }
                                  }
                                },
                                "additionalProperties": true,
                                "description": "Read-only metadata. Refresh scheduling is still being checked separately; do not send it in writes."
                              }
                            },
                            "required": [
                              "id",
                              "title",
                              "facts",
                              "questions",
                              "evidence",
                              "manual",
                              "valid_from",
                              "valid_until"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        },
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "rev": {
                                "type": "integer",
                                "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                                "minimum": 1
                              },
                              "object_id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "type": {
                                "type": "string",
                                "description": "",
                                "enum": [
                                  "text",
                                  "file",
                                  "url"
                                ]
                              },
                              "title": {
                                "type": "string",
                                "description": ""
                              },
                              "url": {
                                "type": "string",
                                "description": ""
                              },
                              "filename": {
                                "type": "string",
                                "description": ""
                              },
                              "text": {
                                "type": "string",
                                "description": "Extracted original text, never raw uploaded file bytes."
                              },
                              "tokens": {
                                "type": "integer",
                                "description": ""
                              },
                              "parsed": {
                                "type": "boolean",
                                "description": ""
                              },
                              "added_at": {
                                "type": "string",
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "source_order": {
                                "type": "integer",
                                "description": ""
                              }
                            },
                            "required": [
                              "id",
                              "rev",
                              "object_id",
                              "type",
                              "title"
                            ],
                            "additionalProperties": true,
                            "description": "Accepted/staged source metadata. Older versions may retain additional metadata."
                          },
                          "description": ""
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": "Plain review reminder."
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "job_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "edit_revision": {
                          "type": "integer",
                          "description": "Draft edit revision; an omitted value means 0.",
                          "minimum": 0,
                          "default": 0
                        }
                      },
                      "required": [
                        "topics",
                        "entries",
                        "warnings"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "owner",
                    "kb",
                    "expected_rev",
                    "data",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "patch_knowledge_bases_kb_drafts_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Edit knowledge draft",
        "description": "Edit one proposed piece while preserving evidence and review requirements. Both base and draft revisions must match. Each save increments data.edit_revision. Server-owned evidence and review flags survive editing; the topic becomes manually corrected.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "owner": {
                      "type": "string",
                      "description": "Owning account ID."
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "expected_rev": {
                      "type": "integer",
                      "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                      "minimum": 1
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "format": {
                          "type": "string",
                          "description": "Current format is pieces-v1."
                        },
                        "topics": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "title": {
                                "type": "string",
                                "description": "Displayed piece title."
                              },
                              "facts": {
                                "type": "string",
                                "description": "Piece text."
                              },
                              "questions": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": ""
                                },
                                "description": "Labels kept from manual entry or earlier imports; new imports do not generate questions."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              },
                              "manual": {
                                "type": "boolean",
                                "description": "True when manually written or corrected."
                              },
                              "valid_from": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "valid_until": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "suppressed": {
                                "type": "boolean",
                                "description": "True while an edited old piece must not be used."
                              },
                              "origin": {
                                "type": "string",
                                "description": "Optional origin marker from earlier imports."
                              },
                              "position": {
                                "type": "object",
                                "properties": {
                                  "added_at": {
                                    "type": "string",
                                    "description": "UTC timestamp.",
                                    "format": "date-time"
                                  },
                                  "source": {
                                    "type": "integer",
                                    "description": ""
                                  },
                                  "segment": {
                                    "type": "integer",
                                    "description": ""
                                  }
                                },
                                "additionalProperties": true,
                                "description": "Stable display-order metadata."
                              },
                              "page_name": {
                                "type": "string",
                                "description": "Optional source page label."
                              },
                              "title_page": {
                                "type": "string",
                                "description": "Optional label used to distinguish similar automatic titles."
                              },
                              "review_flags": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": "",
                                  "enum": [
                                    "agent_instructions",
                                    "suspicious_link",
                                    "payment_details",
                                    "sensitive_data",
                                    "website_junk",
                                    "code_example"
                                  ]
                                },
                                "description": ""
                              },
                              "check_required": {
                                "type": "boolean",
                                "description": "A flagged topic needs explicit individual approval."
                              },
                              "check_reasons": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": "Fixed plain-language review reason."
                                },
                                "description": ""
                              },
                              "check_reason": {
                                "type": "string",
                                "description": "Compatibility joined review reasons."
                              },
                              "keyterms": {
                                "type": "object",
                                "properties": {
                                  "version": {
                                    "type": "integer",
                                    "description": "Stored automatic-term format version."
                                  },
                                  "fingerprint": {
                                    "type": "string",
                                    "description": "Digest of the source text used to validate cached terms."
                                  },
                                  "terms": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "description": "Source-spelled automatic term."
                                    },
                                    "description": "Stored suggested terms."
                                  },
                                  "ranks": {
                                    "type": "object",
                                    "description": "Keys are normalized terms; each value records score (1–4) and essential (boolean).",
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "score": {
                                          "type": "integer",
                                          "description": "Stored importance.",
                                          "minimum": 1,
                                          "maximum": 4
                                        },
                                        "essential": {
                                          "type": "boolean",
                                          "description": "Central identity marker."
                                        }
                                      },
                                      "required": [
                                        "score",
                                        "essential"
                                      ],
                                      "additionalProperties": true,
                                      "description": ""
                                    }
                                  }
                                },
                                "additionalProperties": true,
                                "description": "Read-only metadata. Refresh scheduling is still being checked separately; do not send it in writes."
                              }
                            },
                            "required": [
                              "id",
                              "title",
                              "facts",
                              "questions",
                              "evidence",
                              "manual",
                              "valid_from",
                              "valid_until"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        },
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "rev": {
                                "type": "integer",
                                "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                                "minimum": 1
                              },
                              "object_id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "type": {
                                "type": "string",
                                "description": "",
                                "enum": [
                                  "text",
                                  "file",
                                  "url"
                                ]
                              },
                              "title": {
                                "type": "string",
                                "description": ""
                              },
                              "url": {
                                "type": "string",
                                "description": ""
                              },
                              "filename": {
                                "type": "string",
                                "description": ""
                              },
                              "text": {
                                "type": "string",
                                "description": "Extracted original text, never raw uploaded file bytes."
                              },
                              "tokens": {
                                "type": "integer",
                                "description": ""
                              },
                              "parsed": {
                                "type": "boolean",
                                "description": ""
                              },
                              "added_at": {
                                "type": "string",
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "source_order": {
                                "type": "integer",
                                "description": ""
                              }
                            },
                            "required": [
                              "id",
                              "rev",
                              "object_id",
                              "type",
                              "title"
                            ],
                            "additionalProperties": true,
                            "description": "Accepted/staged source metadata. Older versions may retain additional metadata."
                          },
                          "description": ""
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": "Plain review reminder."
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "job_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "edit_revision": {
                          "type": "integer",
                          "description": "Draft edit revision; an omitted value means 0.",
                          "minimum": 0,
                          "default": 0
                        }
                      },
                      "required": [
                        "topics",
                        "entries",
                        "warnings"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "owner",
                    "kb",
                    "expected_rev",
                    "data",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. draft_closed: This review has already been accepted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  },
                  "expected_draft_revision": {
                    "type": "integer",
                    "description": "Current data.edit_revision, default 0 only when absent.",
                    "minimum": 0
                  },
                  "topic_id": {
                    "type": "string",
                    "description": "Opaque identifier. Keep it as a string.",
                    "format": "uuid"
                  },
                  "topic": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "description": "Optional title. Blank or omitted on edit retains the existing title; on create opening words are used.",
                        "maxLength": 200
                      },
                      "facts": {
                        "type": "string",
                        "description": "Original or manually written piece text; nonblank. A published packed piece must fit 800 tokens.",
                        "minLength": 1,
                        "maxLength": 20000
                      },
                      "questions": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "description": "Legacy searchable question label.",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "description": "Optional compatibility labels; omitted create uses []; omitted edit retains prior labels.",
                        "maxItems": 5
                      },
                      "valid_from": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "UTC timestamp.",
                        "format": "date-time"
                      },
                      "valid_until": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Exclusive validity end; after valid_from when both are set.",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "facts"
                    ],
                    "additionalProperties": true,
                    "description": ""
                  }
                },
                "required": [
                  "expected_revision",
                  "expected_draft_revision",
                  "topic_id",
                  "topic"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "expected_revision": 1,
                "expected_draft_revision": 0,
                "topic_id": "22222222-2222-4222-8222-222222222222",
                "topic": {
                  "title": "Appointments",
                  "facts": "Appointments are available Monday to Friday."
                }
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/drafts/{id}/accept": {
      "post": {
        "operationId": "post_knowledge_bases_kb_drafts_id_accept",
        "tags": [
          "Knowledge"
        ],
        "summary": "Accept knowledge draft",
        "description": "Approve an explicit selection of reviewed pieces and queue publication. Acceptance queues indexing; it is not immediate publication. Unticked existing pieces retain their live versions. Collect individual flagged-piece approval; never auto-fill it. Poll until ready, then read the current base revision.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. draft_closed: This review has already been accepted. review_required: Review and acknowledge the warnings before accepting. suspicious_review_required: Check each flagged topic and tick it individually before going live. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "knowledge_limit: This knowledge base has too much original text. Remove a source or use a separate knowledge base. storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. busy: Please wait for the existing knowledge jobs to finish.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  },
                  "expected_draft_revision": {
                    "type": "integer",
                    "description": "Current draft edit revision. Omission is accepted only for unedited revision 0.",
                    "minimum": 0,
                    "default": 0
                  },
                  "topic_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "Identifier returned by this knowledge base."
                    },
                    "description": "Explicit nonempty selection of draft topic IDs.",
                    "minItems": 1,
                    "uniqueItems": true
                  },
                  "acknowledge_warnings": {
                    "type": "boolean",
                    "description": "Required true when the draft has plain warnings."
                  },
                  "approved_flagged_topic_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "Identifier returned by this knowledge base."
                    },
                    "description": "Exactly the selected flagged IDs approved individually.",
                    "minItems": 0,
                    "uniqueItems": true
                  }
                },
                "required": [
                  "expected_revision",
                  "topic_ids"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "expected_revision": 1,
                "expected_draft_revision": 0,
                "topic_ids": [
                  "22222222-2222-4222-8222-222222222222"
                ]
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/exports": {
      "post": {
        "operationId": "post_knowledge_bases_kb_exports",
        "tags": [
          "Knowledge"
        ],
        "summary": "Create knowledge export",
        "description": "Queue a private export of accepted knowledge and settings. Poll the job until ready, then download using the same job ID within one hour. A changed base revision invalidates the download. Raw uploads are excluded.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "export_limit: This export is too large for one download. Export or remove sources in smaller groups. storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. busy: Please wait for the existing knowledge jobs to finish.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true,
                "description": ""
              },
              "example": {}
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/overview": {
      "get": {
        "operationId": "get_knowledge_bases_kb_overview",
        "tags": [
          "Knowledge"
        ],
        "summary": "Get knowledge overview",
        "description": "Read topic, token, publication, review and seven-day observation totals. Observation totals are best-effort delivery records, not correctness or billing metrics. Loading failures, timeouts and test questions do not count as unanswered real questions.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "topics": {
                      "type": "integer",
                      "description": ""
                    },
                    "tokens": {
                      "type": "integer",
                      "description": "Packed current live topic tokens."
                    },
                    "used_tokens": {
                      "type": "integer",
                      "description": "Original-source tokens plus additional manual text."
                    },
                    "answers": {
                      "type": "integer",
                      "description": "Recorded knowledge-supplied delivered turns over seven days."
                    },
                    "missing": {
                      "type": "integer",
                      "description": "Recorded delivered turns with no retrieval match over seven days."
                    },
                    "last_updated": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "review": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "count": {
                          "type": "integer",
                          "description": ""
                        }
                      },
                      "required": [
                        "id",
                        "count"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    }
                  },
                  "required": [
                    "topics",
                    "tokens",
                    "used_tokens",
                    "answers",
                    "missing",
                    "last_updated",
                    "review"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/settings": {
      "patch": {
        "operationId": "patch_knowledge_bases_kb_settings",
        "tags": [
          "Knowledge"
        ],
        "summary": "Update knowledge settings",
        "description": "Change enabled channels, matching mode or the not-found sentence. Only supplied settings change. An unchanged settings object keeps the revision; a real change increments it. Empty channels disables all knowledge channels.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "owner": {
                      "type": "string",
                      "description": "Owning account identifier; it never grants access when sent by a caller."
                    },
                    "kind": {
                      "type": "string",
                      "description": "Knowledge belongs to an agent.",
                      "const": "agent"
                    },
                    "target": {
                      "type": "string",
                      "description": "Owning agent ID."
                    },
                    "rev": {
                      "type": "integer",
                      "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                      "minimum": 1
                    },
                    "active": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Active published index revision, or null before publication.",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "description": "Lifecycle state.",
                      "enum": [
                        "ready",
                        "deleting",
                        "deleted"
                      ]
                    },
                    "settings": {
                      "type": "object",
                      "properties": {
                        "channels": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": "Channel identifier.",
                            "enum": [
                              "inbound",
                              "outbound",
                              "web_voice",
                              "web_chat",
                              "sms"
                            ]
                          },
                          "description": "Enabled knowledge channels. An empty list turns knowledge off for all channels.",
                          "uniqueItems": true,
                          "default": [
                            "inbound"
                          ]
                        },
                        "match": {
                          "type": "string",
                          "description": "Answer matching mode.",
                          "enum": [
                            "Strict",
                            "Normal"
                          ],
                          "default": "Strict"
                        },
                        "not_found": {
                          "type": "string",
                          "description": "Nonblank response when suitable knowledge is missing.",
                          "minLength": 1,
                          "maxLength": 500,
                          "default": "I don't have that information right now."
                        }
                      },
                      "additionalProperties": false,
                      "description": "Only channels, match and not_found may be supplied. Omitted settings retain the saved value on update."
                    },
                    "tombstones": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "subject_hash": {
                            "type": "string",
                            "description": "Normalized title digest."
                          },
                          "evidence": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "source": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "segment": {
                                  "type": "integer",
                                  "description": "Source segment index."
                                },
                                "quote": {
                                  "type": "string",
                                  "description": "Original evidence text."
                                },
                                "quote_hash": {
                                  "type": "string",
                                  "description": "Digest used by a deletion record."
                                },
                                "topic_id": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "revision": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "title": {
                                  "type": "string",
                                  "description": "Title snapshot at answer time."
                                }
                              },
                              "additionalProperties": true,
                              "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                            },
                            "description": ""
                          }
                        },
                        "required": [
                          "id",
                          "subject_hash",
                          "evidence"
                        ],
                        "additionalProperties": true,
                        "description": ""
                      },
                      "description": "Records that prevent refreshed sources restoring removed pieces."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    }
                  },
                  "required": [
                    "id",
                    "owner",
                    "kind",
                    "target",
                    "rev",
                    "active",
                    "state",
                    "settings",
                    "tombstones",
                    "created_at",
                    "kb"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  },
                  "settings": {
                    "type": "object",
                    "properties": {
                      "channels": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "description": "Channel identifier.",
                          "enum": [
                            "inbound",
                            "outbound",
                            "web_voice",
                            "web_chat",
                            "sms"
                          ]
                        },
                        "description": "Enabled knowledge channels. An empty list turns knowledge off for all channels.",
                        "uniqueItems": true,
                        "default": [
                          "inbound"
                        ]
                      },
                      "match": {
                        "type": "string",
                        "description": "Answer matching mode.",
                        "enum": [
                          "Strict",
                          "Normal"
                        ],
                        "default": "Strict"
                      },
                      "not_found": {
                        "type": "string",
                        "description": "Nonblank response when suitable knowledge is missing.",
                        "minLength": 1,
                        "maxLength": 500,
                        "default": "I don't have that information right now."
                      }
                    },
                    "additionalProperties": false,
                    "description": "Only channels, match and not_found may be supplied. Omitted settings retain the saved value on update."
                  }
                },
                "required": [
                  "expected_revision",
                  "settings"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "expected_revision": 1,
                "settings": {
                  "match": "Normal"
                }
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/sources": {
      "get": {
        "operationId": "get_knowledge_bases_kb_sources",
        "tags": [
          "Knowledge"
        ],
        "summary": "List knowledge sources",
        "description": "List accepted sources that still have unsuppressed live pieces. Sources with no live pieces are omitted. Sources are ordered by ID; use next_cursor. Written-by-you topics without imported evidence do not create a source row.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Maximum rows in this page.",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Opaque cursor from the prior response; omit for the first page."
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "revision": {
                            "type": "integer",
                            "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                            "minimum": 1
                          },
                          "title": {
                            "type": "string",
                            "description": "Saved source title."
                          },
                          "type": {
                            "type": "string",
                            "description": "Stored source type.",
                            "enum": [
                              "text",
                              "file",
                              "url"
                            ]
                          },
                          "url": {
                            "type": "string",
                            "description": "Present for website pages; private source location."
                          },
                          "tokens": {
                            "type": "integer",
                            "description": "Original source token count."
                          },
                          "created_at": {
                            "type": "string",
                            "description": "UTC timestamp.",
                            "format": "date-time"
                          },
                          "topic_count": {
                            "type": "integer",
                            "description": "Unsuppressed live pieces linked to this source."
                          }
                        },
                        "required": [
                          "id",
                          "revision",
                          "title",
                          "type",
                          "created_at"
                        ],
                        "additionalProperties": true,
                        "description": ""
                      },
                      "description": ""
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Opaque cursor. Send it unchanged for the next page; null ends this list."
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "post_knowledge_bases_kb_sources",
        "tags": [
          "Knowledge"
        ],
        "summary": "Import knowledge source",
        "description": "Submit pasted text or a raw file and queue preparation of original-word pieces. Dashboard imports always require review. API review:false may publish after preparation, but flags or reminders always force needs_review. Direct qa and url source types are refused; websites use discovery and selected-page import.\n\nRaw upload: Content-Type application/octet-stream, X-Filename, optional X-Source-Title and X-Review; replacements also require X-Expected-Revision. File maximum 10 MiB; PDF maximum 200 pages. Accept clean UTF-8 text, PDF with selectable text, or DOCX. No raw base64/path input, RTF, executable or active-content documents. Preview scan status is not publication clearance. Without a configured scanner, local_checks_only permits bounded local checks. With a configured scanner, PDF/DOCX need a clean result; clean UTF-8 text can use local checks during an outage. Infected files never bypass. Imports may wait at safety_check/safety_waiting with next_retry_at; after 24 hours scan_expired requires a new upload. Raw files are private and never downloaded; accepted storage retains extracted text.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          },
          {
            "name": "X-Filename",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Required for a raw upload; filename up to 200 characters. Use a genuine PDF, DOCX or UTF-8 text file.",
              "maxLength": 200
            }
          },
          {
            "name": "X-Source-Title",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional source title, at most 200 characters; defaults to filename.",
              "maxLength": 200
            }
          },
          {
            "name": "X-Review",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "For imports: exactly true requests review; other/omitted values mean false for API requests."
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "source_count: This knowledge base can hold up to 50 sources. source_limit: This source contains too much text. Split it into smaller documents. file_limit: This file is too big. Choose a file up to 10 MiB. knowledge_limit: This knowledge base has too much original text. Remove a source or use a separate knowledge base. storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "wrong_type: The file contents do not match its type. Use a genuine PDF, DOCX or plain UTF-8 text file. unsupported_file: Use PDF, DOCX or plain UTF-8 text. Rich text and executable files are not accepted. unsafe_word: This Word file contains macros, embedded files or active content. Save a clean DOCX or paste the text.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "empty_file: This file is empty. Choose a file containing text. unclean_text: This file is not clean UTF-8 text. Save it as UTF-8 without binary data or hidden control characters. unsafe_file: This file failed the virus safety check. Use a clean copy or paste clean text. unsafe_pdf: This PDF contains scripts, actions or embedded files. Export a clean text-only PDF or paste the text. unsafe_word: This Word file contains macros, embedded files or active content. Save a clean DOCX or paste the text. password_pdf: This PDF is password protected. Remove the password from a copy or paste the text. scanned_pdf: This PDF has a page with no readable text. Use a text PDF, convert the scanned pages to text, or paste the text. page_limit: This PDF has more than 200 pages. Split it into smaller documents. archive_limit: This Word document expands beyond the safe size limit. Save a smaller DOCX or paste the text. unreadable: This file is damaged or could not be read safely. Save a new copy or paste the text. parse_timeout: Reading this file took too long. Try a smaller document or paste the text.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. busy: Please wait for the existing knowledge jobs to finish.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet. scan_unavailable: Safety check in progress. We will retry automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "description": "For JSON use text. Files use raw upload; websites use discovery then selection.",
                        "const": "text"
                      },
                      "title": {
                        "type": "string",
                        "description": "Optional name; defaults to opening text or uploaded filename.",
                        "maxLength": 200
                      },
                      "text": {
                        "type": "string",
                        "description": "Nonblank pasted UTF-8 text, maximum 20,000 tokens and 10 MiB transport bytes.",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": true,
                    "description": ""
                  },
                  "review": {
                    "type": "boolean",
                    "description": "True requires a review draft; omitted API value is false.",
                    "default": false
                  }
                },
                "required": [
                  "source"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "source": {
                  "type": "text",
                  "title": "Appointments",
                  "text": "Appointments are available Monday to Friday."
                },
                "review": true
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary",
                "description": "Raw PDF, DOCX or UTF-8 text, at most 10 MiB. Supply X-Filename. Replacement also requires X-Expected-Revision."
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/sources/{id}": {
      "delete": {
        "operationId": "delete_knowledge_bases_kb_sources_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Delete knowledge source",
        "description": "Remove an accepted source with explicit confirmation of affected topics. expected_revision is the base revision. Keeping manual topics detaches this source evidence. Removal revokes pending drafts, jobs and export snapshots for the base so old copies cannot restore deleted text.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "",
                      "const": true
                    },
                    "expected_revision": {
                      "type": "integer",
                      "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "kb",
                    "deleted",
                    "expected_revision"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. confirm_topics: Confirm the affected topics before removing this source. manual_choice: Choose whether to keep or remove manually edited topics. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  },
                  "topic_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "Identifier returned by this knowledge base."
                    },
                    "description": "Must include every affected current topic ID.",
                    "minItems": 0,
                    "uniqueItems": true
                  },
                  "manual": {
                    "type": "string",
                    "description": "Required if affected topics include manual edits.",
                    "enum": [
                      "keep",
                      "delete"
                    ]
                  }
                },
                "required": [
                  "expected_revision",
                  "topic_ids"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "expected_revision": 1,
                "topic_ids": [
                  "22222222-2222-4222-8222-222222222222"
                ],
                "manual": "keep"
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "patch_knowledge_bases_kb_sources_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Rename knowledge source",
        "description": "Change a source name without changing facts or the published index. expected_revision is the SOURCE revision. Success increments source revision only; the base and facts/index revisions stay intact.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "revision": {
                      "type": "integer",
                      "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                      "minimum": 1
                    },
                    "title": {
                      "type": "string",
                      "description": "Saved source title."
                    },
                    "type": {
                      "type": "string",
                      "description": "Stored source type.",
                      "enum": [
                        "text",
                        "file",
                        "url"
                      ]
                    },
                    "url": {
                      "type": "string",
                      "description": "Present for website pages; private source location."
                    },
                    "tokens": {
                      "type": "integer",
                      "description": "Original source token count."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "topic_count": {
                      "type": "integer",
                      "description": "Unsuppressed live pieces linked to this source."
                    }
                  },
                  "required": [
                    "id",
                    "revision",
                    "title",
                    "type",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Nonblank source name, trimmed.",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  }
                },
                "required": [
                  "title",
                  "expected_revision"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "title": "Appointment guide",
                "expected_revision": 1
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/sources/{id}/replacements": {
      "post": {
        "operationId": "post_knowledge_bases_kb_sources_id_replacements",
        "tags": [
          "Knowledge"
        ],
        "summary": "Replace knowledge source",
        "description": "Prepare replacement source text while preserving the accepted version until publication. expected_revision belongs to the source. Raw replacement upload uses X-Expected-Revision. Manual edits and deletion records are protected; an unselected proposed replacement retains the old live piece.\n\nRaw upload: Content-Type application/octet-stream, X-Filename, optional X-Source-Title and X-Review; replacements also require X-Expected-Revision. File maximum 10 MiB; PDF maximum 200 pages. Accept clean UTF-8 text, PDF with selectable text, or DOCX. No raw base64/path input, RTF, executable or active-content documents. Preview scan status is not publication clearance. Without a configured scanner, local_checks_only permits bounded local checks. With a configured scanner, PDF/DOCX need a clean result; clean UTF-8 text can use local checks during an outage. Infected files never bypass. Imports may wait at safety_check/safety_waiting with next_retry_at; after 24 hours scan_expired requires a new upload. Raw files are private and never downloaded; accepted storage retains extracted text.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          },
          {
            "name": "X-Filename",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Required for a raw upload; filename up to 200 characters. Use a genuine PDF, DOCX or UTF-8 text file.",
              "maxLength": 200
            }
          },
          {
            "name": "X-Source-Title",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional source title, at most 200 characters; defaults to filename.",
              "maxLength": 200
            }
          },
          {
            "name": "X-Review",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "For imports: exactly true requests review; other/omitted values mean false for API requests."
            }
          },
          {
            "name": "X-Expected-Revision",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Required for a raw replacement; current source integer revision."
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "source_limit: This source contains too much text. Split it into smaller documents. file_limit: This file is too big. Choose a file up to 10 MiB. knowledge_limit: This knowledge base has too much original text. Remove a source or use a separate knowledge base. storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "wrong_type: The file contents do not match its type. Use a genuine PDF, DOCX or plain UTF-8 text file. unsupported_file: Use PDF, DOCX or plain UTF-8 text. Rich text and executable files are not accepted. unsafe_word: This Word file contains macros, embedded files or active content. Save a clean DOCX or paste the text.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "empty_file: This file is empty. Choose a file containing text. unclean_text: This file is not clean UTF-8 text. Save it as UTF-8 without binary data or hidden control characters. unsafe_file: This file failed the virus safety check. Use a clean copy or paste clean text. unsafe_pdf: This PDF contains scripts, actions or embedded files. Export a clean text-only PDF or paste the text. unsafe_word: This Word file contains macros, embedded files or active content. Save a clean DOCX or paste the text. password_pdf: This PDF is password protected. Remove the password from a copy or paste the text. scanned_pdf: This PDF has a page with no readable text. Use a text PDF, convert the scanned pages to text, or paste the text. page_limit: This PDF has more than 200 pages. Split it into smaller documents. archive_limit: This Word document expands beyond the safe size limit. Save a smaller DOCX or paste the text. unreadable: This file is damaged or could not be read safely. Save a new copy or paste the text. parse_timeout: Reading this file took too long. Try a smaller document or paste the text.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. busy: Please wait for the existing knowledge jobs to finish.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet. scan_unavailable: Safety check in progress. We will retry automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "description": "For JSON use text. Files use raw upload; websites use discovery then selection.",
                        "const": "text"
                      },
                      "title": {
                        "type": "string",
                        "description": "Optional name; defaults to opening text or uploaded filename.",
                        "maxLength": 200
                      },
                      "text": {
                        "type": "string",
                        "description": "Nonblank pasted UTF-8 text, maximum 20,000 tokens and 10 MiB transport bytes.",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": true,
                    "description": ""
                  },
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  },
                  "review": {
                    "type": "boolean",
                    "description": "",
                    "default": false
                  }
                },
                "required": [
                  "source",
                  "expected_revision"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "source": {
                  "type": "text",
                  "text": "Appointments are available Monday through Saturday."
                },
                "expected_revision": 1,
                "review": true
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary",
                "description": "Raw PDF, DOCX or UTF-8 text, at most 10 MiB. Supply X-Filename. Replacement also requires X-Expected-Revision."
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/sources/refresh": {
      "post": {
        "operationId": "post_knowledge_bases_kb_sources_refresh",
        "tags": [
          "Knowledge"
        ],
        "summary": "Refresh website sources",
        "description": "Refresh explicitly selected saved website sources. Only saved website sources can be refreshed, up to 50 inputs. Unchanged pages skip extraction. If some pages fail, readable pages become a draft with one plain reminder; old accepted pages survive.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "source_count: This knowledge base can hold up to 50 sources. knowledge_limit: This knowledge base has too much original text. Remove a source or use a separate knowledge base. storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. busy: Please wait for the existing knowledge jobs to finish.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "source_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "Identifier returned by this knowledge base."
                    },
                    "description": "Owned saved URL source IDs; text and file sources are refused.",
                    "minItems": 1,
                    "uniqueItems": true
                  },
                  "review": {
                    "type": "boolean",
                    "description": "",
                    "default": false
                  }
                },
                "required": [
                  "source_ids"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "source_ids": [
                  "11111111-1111-4111-8111-111111111111"
                ],
                "review": true
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/topic-search": {
      "post": {
        "operationId": "post_knowledge_bases_kb_topic_search",
        "tags": [
          "Knowledge"
        ],
        "summary": "Search knowledge topics",
        "description": "Find related current topics for knowledge management. This POST performs a semantic search, not public call retrieval. It needs no Idempotency-Key and does not change topics. Up to 30 related pieces are returned; use local word filtering when semantic search is unnecessary. Only similarities of at least 0.25 are returned, ordered highest first. An empty live base returns an empty items array and the revision.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "title": {
                            "type": "string",
                            "description": "Displayed piece title."
                          },
                          "facts": {
                            "type": "string",
                            "description": "Piece text."
                          },
                          "questions": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "description": ""
                            },
                            "description": "Labels kept from manual entry or earlier imports; new imports do not generate questions."
                          },
                          "evidence": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "source": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "segment": {
                                  "type": "integer",
                                  "description": "Source segment index."
                                },
                                "quote": {
                                  "type": "string",
                                  "description": "Original evidence text."
                                },
                                "quote_hash": {
                                  "type": "string",
                                  "description": "Digest used by a deletion record."
                                },
                                "topic_id": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "revision": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "title": {
                                  "type": "string",
                                  "description": "Title snapshot at answer time."
                                }
                              },
                              "additionalProperties": true,
                              "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                            },
                            "description": ""
                          },
                          "manual": {
                            "type": "boolean",
                            "description": "True when manually written or corrected."
                          },
                          "valid_from": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "UTC timestamp.",
                            "format": "date-time"
                          },
                          "valid_until": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "UTC timestamp.",
                            "format": "date-time"
                          },
                          "suppressed": {
                            "type": "boolean",
                            "description": "True while an edited old piece must not be used."
                          },
                          "origin": {
                            "type": "string",
                            "description": "Optional origin marker from earlier imports."
                          },
                          "position": {
                            "type": "object",
                            "properties": {
                              "added_at": {
                                "type": "string",
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "source": {
                                "type": "integer",
                                "description": ""
                              },
                              "segment": {
                                "type": "integer",
                                "description": ""
                              }
                            },
                            "additionalProperties": true,
                            "description": "Stable display-order metadata."
                          },
                          "page_name": {
                            "type": "string",
                            "description": "Optional source page label."
                          },
                          "title_page": {
                            "type": "string",
                            "description": "Optional label used to distinguish similar automatic titles."
                          },
                          "review_flags": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "description": "",
                              "enum": [
                                "agent_instructions",
                                "suspicious_link",
                                "payment_details",
                                "sensitive_data",
                                "website_junk",
                                "code_example"
                              ]
                            },
                            "description": ""
                          },
                          "check_required": {
                            "type": "boolean",
                            "description": "A flagged topic needs explicit individual approval."
                          },
                          "check_reasons": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "description": "Fixed plain-language review reason."
                            },
                            "description": ""
                          },
                          "check_reason": {
                            "type": "string",
                            "description": "Compatibility joined review reasons."
                          },
                          "keyterms": {
                            "type": "object",
                            "properties": {
                              "version": {
                                "type": "integer",
                                "description": "Stored automatic-term format version."
                              },
                              "fingerprint": {
                                "type": "string",
                                "description": "Digest of the source text used to validate cached terms."
                              },
                              "terms": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": "Source-spelled automatic term."
                                },
                                "description": "Stored suggested terms."
                              },
                              "ranks": {
                                "type": "object",
                                "description": "Keys are normalized terms; each value records score (1–4) and essential (boolean).",
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "score": {
                                      "type": "integer",
                                      "description": "Stored importance.",
                                      "minimum": 1,
                                      "maximum": 4
                                    },
                                    "essential": {
                                      "type": "boolean",
                                      "description": "Central identity marker."
                                    }
                                  },
                                  "required": [
                                    "score",
                                    "essential"
                                  ],
                                  "additionalProperties": true,
                                  "description": ""
                                }
                              }
                            },
                            "additionalProperties": true,
                            "description": "Read-only metadata. Refresh scheduling is still being checked separately; do not send it in writes."
                          },
                          "score": {
                            "type": "number",
                            "description": "Similarity diagnostic, not correctness."
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "facts",
                          "questions",
                          "evidence",
                          "manual",
                          "valid_from",
                          "valid_until"
                        ],
                        "additionalProperties": true,
                        "description": ""
                      },
                      "description": ""
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 1,
                      "description": "Current knowledge-base revision; not a pagination cursor."
                    }
                  },
                  "required": [
                    "items",
                    "revision"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. knowledge_updating: Knowledge is still changing. Your test is saved; ask again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet. index_version: This knowledge index needs updating before it can be searched. index_unavailable: The search index could not be prepared.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "description": "Trimmed management search text.",
                    "minLength": 2,
                    "maxLength": 200
                  }
                },
                "required": [
                  "query"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "query": "appointment times"
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/topics": {
      "get": {
        "operationId": "get_knowledge_bases_kb_topics",
        "tags": [
          "Knowledge"
        ],
        "summary": "List knowledge topics",
        "description": "List current pieces in their stable display order. A cursor missing from the current topic list returns stale_revision. Reload the first page after publication; pages are not a snapshot.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Maximum rows in this page.",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Opaque cursor from the prior response; omit for the first page."
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "title": {
                            "type": "string",
                            "description": "Displayed piece title."
                          },
                          "facts": {
                            "type": "string",
                            "description": "Piece text."
                          },
                          "questions": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "description": ""
                            },
                            "description": "Labels kept from manual entry or earlier imports; new imports do not generate questions."
                          },
                          "evidence": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "source": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "segment": {
                                  "type": "integer",
                                  "description": "Source segment index."
                                },
                                "quote": {
                                  "type": "string",
                                  "description": "Original evidence text."
                                },
                                "quote_hash": {
                                  "type": "string",
                                  "description": "Digest used by a deletion record."
                                },
                                "topic_id": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "revision": {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                "title": {
                                  "type": "string",
                                  "description": "Title snapshot at answer time."
                                }
                              },
                              "additionalProperties": true,
                              "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                            },
                            "description": ""
                          },
                          "manual": {
                            "type": "boolean",
                            "description": "True when manually written or corrected."
                          },
                          "valid_from": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "UTC timestamp.",
                            "format": "date-time"
                          },
                          "valid_until": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "UTC timestamp.",
                            "format": "date-time"
                          },
                          "suppressed": {
                            "type": "boolean",
                            "description": "True while an edited old piece must not be used."
                          },
                          "origin": {
                            "type": "string",
                            "description": "Optional origin marker from earlier imports."
                          },
                          "position": {
                            "type": "object",
                            "properties": {
                              "added_at": {
                                "type": "string",
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "source": {
                                "type": "integer",
                                "description": ""
                              },
                              "segment": {
                                "type": "integer",
                                "description": ""
                              }
                            },
                            "additionalProperties": true,
                            "description": "Stable display-order metadata."
                          },
                          "page_name": {
                            "type": "string",
                            "description": "Optional source page label."
                          },
                          "title_page": {
                            "type": "string",
                            "description": "Optional label used to distinguish similar automatic titles."
                          },
                          "review_flags": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "description": "",
                              "enum": [
                                "agent_instructions",
                                "suspicious_link",
                                "payment_details",
                                "sensitive_data",
                                "website_junk",
                                "code_example"
                              ]
                            },
                            "description": ""
                          },
                          "check_required": {
                            "type": "boolean",
                            "description": "A flagged topic needs explicit individual approval."
                          },
                          "check_reasons": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "description": "Fixed plain-language review reason."
                            },
                            "description": ""
                          },
                          "check_reason": {
                            "type": "string",
                            "description": "Compatibility joined review reasons."
                          },
                          "keyterms": {
                            "type": "object",
                            "properties": {
                              "version": {
                                "type": "integer",
                                "description": "Stored automatic-term format version."
                              },
                              "fingerprint": {
                                "type": "string",
                                "description": "Digest of the source text used to validate cached terms."
                              },
                              "terms": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": "Source-spelled automatic term."
                                },
                                "description": "Stored suggested terms."
                              },
                              "ranks": {
                                "type": "object",
                                "description": "Keys are normalized terms; each value records score (1–4) and essential (boolean).",
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "score": {
                                      "type": "integer",
                                      "description": "Stored importance.",
                                      "minimum": 1,
                                      "maximum": 4
                                    },
                                    "essential": {
                                      "type": "boolean",
                                      "description": "Central identity marker."
                                    }
                                  },
                                  "required": [
                                    "score",
                                    "essential"
                                  ],
                                  "additionalProperties": true,
                                  "description": ""
                                }
                              }
                            },
                            "additionalProperties": true,
                            "description": "Read-only metadata. Refresh scheduling is still being checked separately; do not send it in writes."
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "facts",
                          "questions",
                          "evidence",
                          "manual",
                          "valid_from",
                          "valid_until"
                        ],
                        "additionalProperties": true,
                        "description": ""
                      },
                      "description": ""
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Opaque cursor. Send it unchanged for the next page; null ends this list."
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "post_knowledge_bases_kb_topics",
        "tags": [
          "Knowledge"
        ],
        "summary": "Create knowledge topic",
        "description": "Create a manually written piece and prepare a fresh index. An oversized packed piece returns needs_review and a draft instead of publishing. A normal piece queues a job. Use complete pieces within 800 packed tokens, including title and retained labels.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "kb": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "kind": {
                          "type": "string",
                          "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                        },
                        "state": {
                          "type": "string",
                          "description": "",
                          "enum": [
                            "pending",
                            "running",
                            "needs_review",
                            "ready",
                            "failed",
                            "cancelled",
                            "deleted"
                          ]
                        },
                        "stage": {
                          "type": "string",
                          "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                        },
                        "progress": {
                          "type": "object",
                          "properties": {
                            "percent": {
                              "type": "integer",
                              "description": "Completed-stage progress, not elapsed-time prediction.",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "phase": {
                              "type": "string",
                              "description": "Reading or naming phase."
                            },
                            "page": {
                              "type": "integer",
                              "description": "Current page number."
                            },
                            "pages": {
                              "type": "integer",
                              "description": "Total input pages or entries."
                            },
                            "completed": {
                              "type": "integer",
                              "description": "Completed preparation units."
                            },
                            "total": {
                              "type": "integer",
                              "description": "Total preparation units."
                            }
                          },
                          "required": [
                            "percent"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "result": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "draft_id": {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "description": ""
                              },
                              "description": ""
                            },
                            "summary": {
                              "type": "object",
                              "properties": {
                                "pages": {
                                  "type": "integer",
                                  "description": "Website pages processed."
                                },
                                "pieces": {
                                  "type": "integer",
                                  "description": "Prepared pieces."
                                },
                                "duplicates_skipped": {
                                  "type": "integer",
                                  "description": "Duplicate pieces or repeated source skipped."
                                }
                              },
                              "additionalProperties": true,
                              "description": ""
                            },
                            "unchanged": {
                              "type": "boolean",
                              "description": "No new publishable content was produced."
                            },
                            "revision": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                {
                                  "type": "integer",
                                  "description": "Integer revision for an export snapshot."
                                }
                              ]
                            },
                            "expected_revision": {
                              "type": "integer",
                              "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                              "minimum": 1
                            },
                            "expires_at": {
                              "type": "string",
                              "description": "UTC timestamp.",
                              "format": "date-time"
                            },
                            "deleted": {
                              "type": "boolean",
                              "description": ""
                            },
                            "private_objects_remaining": {
                              "type": "integer",
                              "description": ""
                            },
                            "pages": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "description": "Discovery page ID, use exactly as returned."
                                  },
                                  "url": {
                                    "type": "string",
                                    "description": "Discovered public page URL."
                                  },
                                  "title": {
                                    "type": "string",
                                    "description": "Discovered page title."
                                  }
                                },
                                "required": [
                                  "id",
                                  "url"
                                ],
                                "additionalProperties": true,
                                "description": ""
                              },
                              "description": ""
                            }
                          },
                          "additionalProperties": true,
                          "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                        },
                        "error": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "code": {
                              "type": "string",
                              "description": "Machine-readable failure code; see the error catalog."
                            },
                            "message": {
                              "type": "string",
                              "description": "Display as escaped text; never execute or insert as HTML."
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "next_retry_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "paid_work_started": {
                          "type": "boolean",
                          "description": "Whether paid preparation work began; not an invoice or an additional charge."
                        },
                        "created_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "kb",
                        "kind",
                        "state",
                        "stage",
                        "progress",
                        "result",
                        "error",
                        "next_retry_at",
                        "paid_work_started",
                        "created_at"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kb": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "state": {
                          "type": "string",
                          "description": "",
                          "const": "needs_review"
                        },
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "kb",
                        "state",
                        "draft_id"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "topic_limit: There are too many topics. knowledge_limit: This knowledge base has too much original text. Remove a source or use a separate knowledge base. storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. busy: Please wait for the existing knowledge jobs to finish.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  },
                  "topic": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "description": "Optional title. Blank or omitted on edit retains the existing title; on create opening words are used.",
                        "maxLength": 200
                      },
                      "facts": {
                        "type": "string",
                        "description": "Original or manually written piece text; nonblank. A published packed piece must fit 800 tokens.",
                        "minLength": 1,
                        "maxLength": 20000
                      },
                      "questions": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "description": "Legacy searchable question label.",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "description": "Optional compatibility labels; omitted create uses []; omitted edit retains prior labels.",
                        "maxItems": 5
                      },
                      "valid_from": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "UTC timestamp.",
                        "format": "date-time"
                      },
                      "valid_until": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Exclusive validity end; after valid_from when both are set.",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "facts"
                    ],
                    "additionalProperties": true,
                    "description": ""
                  }
                },
                "required": [
                  "expected_revision",
                  "topic"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "expected_revision": 1,
                "topic": {
                  "title": "Appointments",
                  "facts": "Appointments are available Monday to Friday."
                }
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/topics/{id}": {
      "delete": {
        "operationId": "delete_knowledge_bases_kb_topics_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Delete knowledge topic",
        "description": "Remove a current piece and prevent source refresh from restoring it. Deletion is immediate and records a tombstone. Removing the final piece linked to a source also removes that source and original, and revokes stale pending copies.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "",
                      "const": true
                    },
                    "expected_revision": {
                      "type": "integer",
                      "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "kb",
                    "deleted",
                    "expected_revision"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  }
                },
                "required": [
                  "expected_revision"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "expected_revision": 1
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_knowledge_bases_kb_topics_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Get knowledge topic",
        "description": "Read one current piece, its evidence and saved metadata. The identifier must belong to the current active revision. A deleted or inaccessible topic returns not_found.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "title": {
                      "type": "string",
                      "description": "Displayed piece title."
                    },
                    "facts": {
                      "type": "string",
                      "description": "Piece text."
                    },
                    "questions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": ""
                      },
                      "description": "Labels kept from manual entry or earlier imports; new imports do not generate questions."
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "segment": {
                            "type": "integer",
                            "description": "Source segment index."
                          },
                          "quote": {
                            "type": "string",
                            "description": "Original evidence text."
                          },
                          "quote_hash": {
                            "type": "string",
                            "description": "Digest used by a deletion record."
                          },
                          "topic_id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "revision": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "title": {
                            "type": "string",
                            "description": "Title snapshot at answer time."
                          }
                        },
                        "additionalProperties": true,
                        "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                      },
                      "description": ""
                    },
                    "manual": {
                      "type": "boolean",
                      "description": "True when manually written or corrected."
                    },
                    "valid_from": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "valid_until": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "suppressed": {
                      "type": "boolean",
                      "description": "True while an edited old piece must not be used."
                    },
                    "origin": {
                      "type": "string",
                      "description": "Optional origin marker from earlier imports."
                    },
                    "position": {
                      "type": "object",
                      "properties": {
                        "added_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "source": {
                          "type": "integer",
                          "description": ""
                        },
                        "segment": {
                          "type": "integer",
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Stable display-order metadata."
                    },
                    "page_name": {
                      "type": "string",
                      "description": "Optional source page label."
                    },
                    "title_page": {
                      "type": "string",
                      "description": "Optional label used to distinguish similar automatic titles."
                    },
                    "review_flags": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "",
                        "enum": [
                          "agent_instructions",
                          "suspicious_link",
                          "payment_details",
                          "sensitive_data",
                          "website_junk",
                          "code_example"
                        ]
                      },
                      "description": ""
                    },
                    "check_required": {
                      "type": "boolean",
                      "description": "A flagged topic needs explicit individual approval."
                    },
                    "check_reasons": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "Fixed plain-language review reason."
                      },
                      "description": ""
                    },
                    "check_reason": {
                      "type": "string",
                      "description": "Compatibility joined review reasons."
                    },
                    "keyterms": {
                      "type": "object",
                      "properties": {
                        "version": {
                          "type": "integer",
                          "description": "Stored automatic-term format version."
                        },
                        "fingerprint": {
                          "type": "string",
                          "description": "Digest of the source text used to validate cached terms."
                        },
                        "terms": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": "Source-spelled automatic term."
                          },
                          "description": "Stored suggested terms."
                        },
                        "ranks": {
                          "type": "object",
                          "description": "Keys are normalized terms; each value records score (1–4) and essential (boolean).",
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "score": {
                                "type": "integer",
                                "description": "Stored importance.",
                                "minimum": 1,
                                "maximum": 4
                              },
                              "essential": {
                                "type": "boolean",
                                "description": "Central identity marker."
                              }
                            },
                            "required": [
                              "score",
                              "essential"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          }
                        }
                      },
                      "additionalProperties": true,
                      "description": "Read-only metadata. Refresh scheduling is still being checked separately; do not send it in writes."
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "facts",
                    "questions",
                    "evidence",
                    "manual",
                    "valid_from",
                    "valid_until"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "patch_knowledge_bases_kb_topics_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Update knowledge topic",
        "description": "Correct a live piece and prepare its replacement index. The old answer is suppressed immediately for a normal update while indexing runs. A blank title keeps the current title; omitted questions keep existing labels. Oversized text returns a draft for splitting.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "kb": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "kind": {
                          "type": "string",
                          "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                        },
                        "state": {
                          "type": "string",
                          "description": "",
                          "enum": [
                            "pending",
                            "running",
                            "needs_review",
                            "ready",
                            "failed",
                            "cancelled",
                            "deleted"
                          ]
                        },
                        "stage": {
                          "type": "string",
                          "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                        },
                        "progress": {
                          "type": "object",
                          "properties": {
                            "percent": {
                              "type": "integer",
                              "description": "Completed-stage progress, not elapsed-time prediction.",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "phase": {
                              "type": "string",
                              "description": "Reading or naming phase."
                            },
                            "page": {
                              "type": "integer",
                              "description": "Current page number."
                            },
                            "pages": {
                              "type": "integer",
                              "description": "Total input pages or entries."
                            },
                            "completed": {
                              "type": "integer",
                              "description": "Completed preparation units."
                            },
                            "total": {
                              "type": "integer",
                              "description": "Total preparation units."
                            }
                          },
                          "required": [
                            "percent"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "result": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "draft_id": {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "description": ""
                              },
                              "description": ""
                            },
                            "summary": {
                              "type": "object",
                              "properties": {
                                "pages": {
                                  "type": "integer",
                                  "description": "Website pages processed."
                                },
                                "pieces": {
                                  "type": "integer",
                                  "description": "Prepared pieces."
                                },
                                "duplicates_skipped": {
                                  "type": "integer",
                                  "description": "Duplicate pieces or repeated source skipped."
                                }
                              },
                              "additionalProperties": true,
                              "description": ""
                            },
                            "unchanged": {
                              "type": "boolean",
                              "description": "No new publishable content was produced."
                            },
                            "revision": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "description": "Opaque identifier. Keep it as a string.",
                                  "format": "uuid"
                                },
                                {
                                  "type": "integer",
                                  "description": "Integer revision for an export snapshot."
                                }
                              ]
                            },
                            "expected_revision": {
                              "type": "integer",
                              "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                              "minimum": 1
                            },
                            "expires_at": {
                              "type": "string",
                              "description": "UTC timestamp.",
                              "format": "date-time"
                            },
                            "deleted": {
                              "type": "boolean",
                              "description": ""
                            },
                            "private_objects_remaining": {
                              "type": "integer",
                              "description": ""
                            },
                            "pages": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "description": "Discovery page ID, use exactly as returned."
                                  },
                                  "url": {
                                    "type": "string",
                                    "description": "Discovered public page URL."
                                  },
                                  "title": {
                                    "type": "string",
                                    "description": "Discovered page title."
                                  }
                                },
                                "required": [
                                  "id",
                                  "url"
                                ],
                                "additionalProperties": true,
                                "description": ""
                              },
                              "description": ""
                            }
                          },
                          "additionalProperties": true,
                          "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                        },
                        "error": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "code": {
                              "type": "string",
                              "description": "Machine-readable failure code; see the error catalog."
                            },
                            "message": {
                              "type": "string",
                              "description": "Display as escaped text; never execute or insert as HTML."
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "next_retry_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "paid_work_started": {
                          "type": "boolean",
                          "description": "Whether paid preparation work began; not an invoice or an additional charge."
                        },
                        "created_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "kb",
                        "kind",
                        "state",
                        "stage",
                        "progress",
                        "result",
                        "error",
                        "next_retry_at",
                        "paid_work_started",
                        "created_at"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kb": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "state": {
                          "type": "string",
                          "description": "",
                          "const": "needs_review"
                        },
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "kb",
                        "state",
                        "draft_id"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "topic_limit: There are too many topics. knowledge_limit: This knowledge base has too much original text. Remove a source or use a separate knowledge base. storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. busy: Please wait for the existing knowledge jobs to finish.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                    "minimum": 1
                  },
                  "topic": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "description": "Optional title. Blank or omitted on edit retains the existing title; on create opening words are used.",
                        "maxLength": 200
                      },
                      "facts": {
                        "type": "string",
                        "description": "Original or manually written piece text; nonblank. A published packed piece must fit 800 tokens.",
                        "minLength": 1,
                        "maxLength": 20000
                      },
                      "questions": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "description": "Legacy searchable question label.",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "description": "Optional compatibility labels; omitted create uses []; omitted edit retains prior labels.",
                        "maxItems": 5
                      },
                      "valid_from": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "UTC timestamp.",
                        "format": "date-time"
                      },
                      "valid_until": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Exclusive validity end; after valid_from when both are set.",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "facts"
                    ],
                    "additionalProperties": true,
                    "description": ""
                  }
                },
                "required": [
                  "expected_revision",
                  "topic"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "expected_revision": 1,
                "topic": {
                  "facts": "Appointments are available Monday through Saturday."
                }
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/unanswered": {
      "get": {
        "operationId": "get_knowledge_bases_kb_unanswered",
        "tags": [
          "Knowledge"
        ],
        "summary": "List unanswered questions",
        "description": "Read recent real questions from delivered turns without a retrieval match. Seven-day retention. Tester questions and load/timeout failures are excluded. Small-base whole-context mode cannot identify every unknown question, so the list is intentionally incomplete.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Maximum rows in this page.",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Opaque cursor from the prior response; omit for the first page."
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "question": {
                            "type": "string",
                            "description": "Private question, truncated to 4,000 characters.",
                            "maxLength": 4000
                          },
                          "channel": {
                            "type": "string",
                            "description": "",
                            "enum": [
                              "inbound",
                              "outbound",
                              "web_voice",
                              "web_chat",
                              "sms"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "description": "UTC timestamp.",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "id",
                          "question",
                          "channel",
                          "created_at"
                        ],
                        "additionalProperties": true,
                        "description": ""
                      },
                      "description": ""
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Opaque cursor. Send it unchanged for the next page; null ends this list."
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/website-discoveries": {
      "post": {
        "operationId": "post_knowledge_bases_kb_website_discoveries",
        "tags": [
          "Knowledge"
        ],
        "summary": "Discover website pages",
        "description": "Discover selectable public pages without importing or publishing them. Poll the discovery job for result.pages. Up to 200 candidates; choose only the page IDs returned by that owned discovery. Discovery creates a job but no accepted source.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "page_unreadable: We could not read this page. Check the address, or paste its text instead. robots_blocked: This website does not allow this page to be imported. Paste permitted text instead.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. busy: Please wait for the existing knowledge jobs to finish.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet. page_unavailable: This website is taking too long to reply. Try again later.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Public HTTP(S) website URL without credentials, IP literals or private addresses.",
                    "format": "uri"
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "url": "https://example.com"
              }
            }
          }
        }
      }
    },
    "/knowledge-bases/{kb}/website-imports": {
      "post": {
        "operationId": "post_knowledge_bases_kb_website_imports",
        "tags": [
          "Knowledge"
        ],
        "summary": "Import selected pages",
        "description": "Import only pages chosen from a completed owned website discovery. The discovery must be ready and owned by this base. At most 50 sources can be submitted or saved. Saved matching URLs become replacements; explicit selection is required.",
        "parameters": [
          {
            "name": "kb",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "source_count: This knowledge base can hold up to 50 sources. knowledge_limit: This knowledge base has too much original text. Remove a source or use a separate knowledge base. storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. busy: Please wait for the existing knowledge jobs to finish.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "discovery_id": {
                    "type": "string",
                    "description": "Opaque identifier. Keep it as a string.",
                    "format": "uuid"
                  },
                  "page_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "Identifier returned by this knowledge base."
                    },
                    "description": "Unique IDs returned by the ready discovery.",
                    "minItems": 1,
                    "uniqueItems": true
                  },
                  "review": {
                    "type": "boolean",
                    "description": "",
                    "default": false
                  }
                },
                "required": [
                  "discovery_id",
                  "page_ids"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "discovery_id": "11111111-1111-4111-8111-111111111111",
                "page_ids": [
                  "page_fixture"
                ],
                "review": true
              }
            }
          }
        }
      }
    },
    "/knowledge/capabilities": {
      "get": {
        "operationId": "get_knowledge_capabilities",
        "tags": [
          "Knowledge"
        ],
        "summary": "Get knowledge capabilities",
        "description": "Read current knowledge limits, defaults and account scope marker. Use returned limits instead of hard-coding runtime configuration. Legacy training/note counters remain for compatibility; their endpoints are removed. The released flag is a rollout marker.",
        "parameters": [],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "released": {
                      "type": "boolean",
                      "description": "Current rollout marker; false is not a route failure."
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "fileBytes": {
                          "type": "integer",
                          "description": "Maximum raw upload bytes: 10 MiB.",
                          "example": 10485760
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Maximum PDF pages.",
                          "example": 200
                        },
                        "sourceTokens": {
                          "type": "integer",
                          "description": "Maximum tokens per source.",
                          "example": 20000
                        },
                        "kbTokens": {
                          "type": "integer",
                          "description": "Maximum original-text tokens per base, including additional manual text.",
                          "example": 100000
                        },
                        "sources": {
                          "type": "integer",
                          "description": "Maximum sources per base.",
                          "example": 50
                        },
                        "topics": {
                          "type": "integer",
                          "description": "Maximum topics per base.",
                          "example": 1000
                        },
                        "bases": {
                          "type": "integer",
                          "description": "Maximum active agent bases per account.",
                          "example": 20
                        },
                        "accountBytes": {
                          "type": "integer",
                          "description": "Private account storage cap, 100 MiB.",
                          "example": 104857600
                        },
                        "topicTokens": {
                          "type": "integer",
                          "description": "Maximum packed tokens per published piece.",
                          "example": 800
                        },
                        "packTokens": {
                          "type": "integer",
                          "description": "Current runtime knowledge-pack budget; use the returned value.",
                          "example": 800
                        },
                        "mainPromptTokens": {
                          "type": "integer",
                          "description": "Main prompt token limit with knowledge enabled.",
                          "example": 3000
                        },
                        "sessionMs": {
                          "type": "integer",
                          "description": "Legacy five-minute value; knowledge Test has no training wait or timer gate.",
                          "example": 300000
                        },
                        "kbDaily": {
                          "type": "integer",
                          "description": "Legacy per-base training counter; training is removed.",
                          "example": 3
                        },
                        "accountDaily": {
                          "type": "integer",
                          "description": "Legacy account training counter; training is removed.",
                          "example": 30
                        },
                        "notes": {
                          "type": "integer",
                          "description": "Legacy note limit; note routes are removed.",
                          "example": 20
                        },
                        "noteChars": {
                          "type": "integer",
                          "description": "Legacy note size; note routes are removed.",
                          "example": 2000
                        },
                        "messageChars": {
                          "type": "integer",
                          "description": "Maximum question characters.",
                          "example": 4000
                        },
                        "messages": {
                          "type": "integer",
                          "description": "Latest retained conversation messages.",
                          "example": 100
                        },
                        "jobs": {
                          "type": "integer",
                          "description": "Maximum pending/running/review jobs per account.",
                          "example": 8
                        },
                        "parseMs": {
                          "type": "integer",
                          "description": "Bounded file-reader timeout, milliseconds.",
                          "example": 15000
                        },
                        "discoveryPages": {
                          "type": "integer",
                          "description": "Maximum discovered website pages.",
                          "example": 200
                        },
                        "leaseMs": {
                          "type": "integer",
                          "description": "Worker lease duration, milliseconds; not a client timeout.",
                          "example": 240000
                        },
                        "attempts": {
                          "type": "integer",
                          "description": "Maximum processing attempts per job.",
                          "example": 3
                        },
                        "retainedDays": {
                          "type": "integer",
                          "description": "Retention for transient jobs, drafts, sessions and unanswered observations.",
                          "example": 7
                        }
                      },
                      "additionalProperties": true,
                      "description": ""
                    },
                    "defaults": {
                      "type": "object",
                      "properties": {
                        "channels": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": "Channel identifier.",
                            "enum": [
                              "inbound",
                              "outbound",
                              "web_voice",
                              "web_chat",
                              "sms"
                            ]
                          },
                          "description": "Enabled knowledge channels. An empty list turns knowledge off for all channels.",
                          "uniqueItems": true,
                          "default": [
                            "inbound"
                          ]
                        },
                        "match": {
                          "type": "string",
                          "description": "Answer matching mode.",
                          "enum": [
                            "Strict",
                            "Normal"
                          ],
                          "default": "Strict"
                        },
                        "not_found": {
                          "type": "string",
                          "description": "Nonblank response when suitable knowledge is missing.",
                          "minLength": 1,
                          "maxLength": 500,
                          "default": "I don't have that information right now."
                        }
                      },
                      "additionalProperties": false,
                      "description": "Only channels, match and not_found may be supplied. Omitted settings retain the saved value on update."
                    },
                    "channels": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "",
                        "enum": [
                          "inbound",
                          "outbound",
                          "web_voice",
                          "web_chat",
                          "sms"
                        ]
                      },
                      "description": ""
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "",
                        "enum": [
                          "file",
                          "text",
                          "website"
                        ]
                      },
                      "description": ""
                    },
                    "test_questions": {
                      "type": "string",
                      "description": "",
                      "const": "unlimited"
                    },
                    "training": {
                      "type": "boolean",
                      "description": "",
                      "const": false
                    },
                    "preparation": {
                      "type": "string",
                      "description": "",
                      "const": "original_words"
                    },
                    "scope_id": {
                      "type": "string",
                      "description": "Opaque account partition marker, 24 characters."
                    },
                    "policy_version": {
                      "type": "string",
                      "description": "Policy compatibility version."
                    }
                  },
                  "required": [
                    "released",
                    "limits",
                    "defaults",
                    "channels",
                    "sources",
                    "test_questions",
                    "training",
                    "preparation",
                    "scope_id",
                    "policy_version"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/knowledge/events": {
      "get": {
        "operationId": "get_knowledge_events",
        "tags": [
          "Knowledge"
        ],
        "summary": "Read knowledge events",
        "description": "Read ordered owner-scoped knowledge events for reconciliation. This endpoint returns an array, not items/next_cursor. Send the final sequence string as cursor; an empty result means caught up. Reconcile by IDs and current revisions.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Last seen decimal sequence; use 0 initially.",
              "pattern": "^\\d+$",
              "default": "0"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "sequence": {
                        "type": "string",
                        "description": "Decimal sequence string. Keep exact; pass the last sequence as cursor."
                      },
                      "id": {
                        "type": "string",
                        "description": "Opaque identifier. Keep it as a string.",
                        "format": "uuid"
                      },
                      "kb": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Opaque identifier. Keep it as a string.",
                        "format": "uuid"
                      },
                      "type": {
                        "type": "string",
                        "description": "Event name such as knowledge.updated or knowledge.job_ready."
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "revision": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "description": ""
                              },
                              {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              }
                            ]
                          },
                          "job_id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "kind": {
                            "type": "string",
                            "description": ""
                          },
                          "topic_id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "source_id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "topic_count": {
                            "type": "integer",
                            "description": ""
                          },
                          "question": {
                            "type": "string",
                            "description": "Private unanswered observation text, when present."
                          },
                          "channel": {
                            "type": "string",
                            "description": ""
                          },
                          "found": {
                            "type": "boolean",
                            "description": ""
                          }
                        },
                        "additionalProperties": true,
                        "description": "Event-specific data; additional event fields can be present."
                      },
                      "created_at": {
                        "type": "string",
                        "description": "UTC timestamp.",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "sequence",
                      "id",
                      "kb",
                      "type",
                      "data",
                      "created_at"
                    ],
                    "additionalProperties": true,
                    "description": ""
                  },
                  "description": "Up to 100 events in increasing sequence order."
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/knowledge/exports/{id}": {
      "get": {
        "operationId": "get_knowledge_exports_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Download knowledge export",
        "description": "Download a ready private export as structured JSON or readable text. No new export is created by this GET. The export must be ready, unexpired (one hour) and at the same base revision. format=text still returns a JSON envelope with filename, content_type and text; save text privately. JSON excludes raw uploads. Accepted text bytes are bounded at 35 MiB and serialized JSON at 50 MiB.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "JSON envelope type.",
              "enum": [
                "json",
                "text"
              ],
              "default": "json"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "format": {
                          "type": "string",
                          "description": "",
                          "const": "nixflex-knowledge-v1"
                        },
                        "kb": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "settings": {
                          "type": "object",
                          "properties": {
                            "channels": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "description": "Channel identifier.",
                                "enum": [
                                  "inbound",
                                  "outbound",
                                  "web_voice",
                                  "web_chat",
                                  "sms"
                                ]
                              },
                              "description": "Enabled knowledge channels. An empty list turns knowledge off for all channels.",
                              "uniqueItems": true,
                              "default": [
                                "inbound"
                              ]
                            },
                            "match": {
                              "type": "string",
                              "description": "Answer matching mode.",
                              "enum": [
                                "Strict",
                                "Normal"
                              ],
                              "default": "Strict"
                            },
                            "not_found": {
                              "type": "string",
                              "description": "Nonblank response when suitable knowledge is missing.",
                              "minLength": 1,
                              "maxLength": 500,
                              "default": "I don't have that information right now."
                            }
                          },
                          "additionalProperties": false,
                          "description": "Only channels, match and not_found may be supplied. Omitted settings retain the saved value on update."
                        },
                        "sources": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "rev": {
                                "type": "integer",
                                "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                                "minimum": 1
                              },
                              "object_id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "type": {
                                "type": "string",
                                "description": "",
                                "enum": [
                                  "text",
                                  "file",
                                  "url"
                                ]
                              },
                              "title": {
                                "type": "string",
                                "description": ""
                              },
                              "url": {
                                "type": "string",
                                "description": ""
                              },
                              "filename": {
                                "type": "string",
                                "description": ""
                              },
                              "text": {
                                "type": "string",
                                "description": "Extracted original text, never raw uploaded file bytes."
                              },
                              "tokens": {
                                "type": "integer",
                                "description": ""
                              },
                              "parsed": {
                                "type": "boolean",
                                "description": ""
                              },
                              "added_at": {
                                "type": "string",
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "source_order": {
                                "type": "integer",
                                "description": ""
                              }
                            },
                            "required": [
                              "id",
                              "rev",
                              "object_id",
                              "type",
                              "title"
                            ],
                            "additionalProperties": true,
                            "description": "Accepted/staged source metadata. Older versions may retain additional metadata."
                          },
                          "description": ""
                        },
                        "topics": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "title": {
                                "type": "string",
                                "description": "Displayed piece title."
                              },
                              "facts": {
                                "type": "string",
                                "description": "Piece text."
                              },
                              "questions": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": ""
                                },
                                "description": "Labels kept from manual entry or earlier imports; new imports do not generate questions."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              },
                              "manual": {
                                "type": "boolean",
                                "description": "True when manually written or corrected."
                              },
                              "valid_from": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "valid_until": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "UTC timestamp.",
                                "format": "date-time"
                              },
                              "suppressed": {
                                "type": "boolean",
                                "description": "True while an edited old piece must not be used."
                              },
                              "origin": {
                                "type": "string",
                                "description": "Optional origin marker from earlier imports."
                              },
                              "position": {
                                "type": "object",
                                "properties": {
                                  "added_at": {
                                    "type": "string",
                                    "description": "UTC timestamp.",
                                    "format": "date-time"
                                  },
                                  "source": {
                                    "type": "integer",
                                    "description": ""
                                  },
                                  "segment": {
                                    "type": "integer",
                                    "description": ""
                                  }
                                },
                                "additionalProperties": true,
                                "description": "Stable display-order metadata."
                              },
                              "page_name": {
                                "type": "string",
                                "description": "Optional source page label."
                              },
                              "title_page": {
                                "type": "string",
                                "description": "Optional label used to distinguish similar automatic titles."
                              },
                              "review_flags": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": "",
                                  "enum": [
                                    "agent_instructions",
                                    "suspicious_link",
                                    "payment_details",
                                    "sensitive_data",
                                    "website_junk",
                                    "code_example"
                                  ]
                                },
                                "description": ""
                              },
                              "check_required": {
                                "type": "boolean",
                                "description": "A flagged topic needs explicit individual approval."
                              },
                              "check_reasons": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "description": "Fixed plain-language review reason."
                                },
                                "description": ""
                              },
                              "check_reason": {
                                "type": "string",
                                "description": "Compatibility joined review reasons."
                              },
                              "keyterms": {
                                "type": "object",
                                "properties": {
                                  "version": {
                                    "type": "integer",
                                    "description": "Stored automatic-term format version."
                                  },
                                  "fingerprint": {
                                    "type": "string",
                                    "description": "Digest of the source text used to validate cached terms."
                                  },
                                  "terms": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "description": "Source-spelled automatic term."
                                    },
                                    "description": "Stored suggested terms."
                                  },
                                  "ranks": {
                                    "type": "object",
                                    "description": "Keys are normalized terms; each value records score (1–4) and essential (boolean).",
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "score": {
                                          "type": "integer",
                                          "description": "Stored importance.",
                                          "minimum": 1,
                                          "maximum": 4
                                        },
                                        "essential": {
                                          "type": "boolean",
                                          "description": "Central identity marker."
                                        }
                                      },
                                      "required": [
                                        "score",
                                        "essential"
                                      ],
                                      "additionalProperties": true,
                                      "description": ""
                                    }
                                  }
                                },
                                "additionalProperties": true,
                                "description": "Read-only metadata. Refresh scheduling is still being checked separately; do not send it in writes."
                              }
                            },
                            "required": [
                              "id",
                              "title",
                              "facts",
                              "questions",
                              "evidence",
                              "manual",
                              "valid_from",
                              "valid_until"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        },
                        "tombstones": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "subject_hash": {
                                "type": "string",
                                "description": "Normalized title digest."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              }
                            },
                            "required": [
                              "id",
                              "subject_hash",
                              "evidence"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        },
                        "objects": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "media": {
                                "type": "string",
                                "description": "",
                                "const": "text/plain"
                              },
                              "digest": {
                                "type": "string",
                                "description": "Content digest."
                              },
                              "base64": {
                                "type": "string",
                                "description": "Accepted extracted-text bytes encoded as base64, not uploaded raw-file bytes."
                              }
                            },
                            "required": [
                              "id",
                              "media",
                              "digest",
                              "base64"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "required": [
                        "format",
                        "kb",
                        "settings",
                        "sources",
                        "topics",
                        "tombstones",
                        "objects"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    {
                      "type": "object",
                      "properties": {
                        "filename": {
                          "type": "string",
                          "description": "",
                          "example": "knowledge.txt"
                        },
                        "content_type": {
                          "type": "string",
                          "description": "",
                          "example": "text/plain; charset=utf-8"
                        },
                        "text": {
                          "type": "string",
                          "description": "All unsuppressed live piece titles/text and plain settings."
                        }
                      },
                      "required": [
                        "filename",
                        "content_type",
                        "text"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. export_expired: Request a new private export.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "export_limit: This export is too large for one download. Export or remove sources in smaller groups.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/knowledge/jobs/{id}": {
      "get": {
        "operationId": "get_knowledge_jobs_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Get knowledge job",
        "description": "Poll authoritative job state, progress, result and safe failure details. Poll with bounded backoff and respect next_retry_at for scheduled safety checks. needs_review requires explicit review; ready may mean unchanged, exported or published depending on kind/result. Never invent progress from elapsed time.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_operation: Unknown knowledge operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. export_expired: Request a new private export. stale_revision: The list changed. Reload it to see the latest pieces. draft_closed: This review has already been accepted. review_required: Review and acknowledge the warnings before accepting. suspicious_review_required: Check each flagged topic and tick it individually before going live. knowledge_missing: Add and approve at least one topic before testing. target_changed: The selected knowledge changed. Start a new test. session_closed: Start a new knowledge test. job_cancelled: This job has stopped. delete_committed: Deletion has already revoked access and must finish. retry_unavailable: That file has expired. Upload it again or paste its text. idempotency_conflict: Use a new Idempotency-Key for different information. confirm_topics: Confirm the affected topics before removing this source. manual_choice: Choose whether to keep or remove manually edited topics. message_busy: Wait for the current test reply. message_in_progress: This test reply is still pending. Read the session before retrying. draft_changed: The preview changed. Reopen the review to test it. knowledge_updating: Knowledge is still changing. Your test is saved; ask again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "410": {
            "description": "training_removed: Training has been removed. Edit a piece instead. number_knowledge_removed: Knowledge belongs to an agent now. Open the attached agent’s knowledge.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "topic_limit: There are too many topics. source_count: This knowledge base can hold up to 50 sources. knowledge_limit: This knowledge base has too much original text. Remove a source or use a separate knowledge base. source_limit: This source contains too much text. Split it into smaller documents. export_limit: This export is too large for one download. Export or remove sources in smaller groups. file_limit: This file is too big. Choose a file up to 10 MiB. storage_limit: Your account has reached its private storage limit. Remove old sources first. provider_limit: The prepared answer was too large. context_limit: All originals and notes do not fit this preparation model. Use a larger configured model or smaller knowledge base; nothing was cut off. embedding_limit: Split this topic into smaller complete topics.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "wrong_type: The file contents do not match its type. Use a genuine PDF, DOCX or plain UTF-8 text file. unsupported_file: Use PDF, DOCX or plain UTF-8 text. Rich text and executable files are not accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "empty_topic: Add text to the empty piece or leave it unticked before going live. split_topic: Split the large piece into smaller pieces before publishing. invalid_keyterms: The automatic words could not be checked. Your saved knowledge is unchanged. unreadable: This file is damaged or could not be read safely. Save a new copy or paste the text. empty_file: This file is empty. Choose a file containing text. unsafe_file: This file failed the virus safety check. Use a clean copy or paste clean text. sources_unreadable: None of the selected pages could be read. Paste the text instead. page_unreadable: We could not read this page. Check the address, or paste its text instead. robots_blocked: This website does not allow this page to be imported. Paste permitted text instead. invalid_topics: The prepared topics could not be checked. Try again. unclean_text: This file is not clean UTF-8 text. Save it as UTF-8 without binary data or hidden control characters. unsafe_pdf: This PDF contains scripts, actions or embedded files. Export a clean text-only PDF or paste the text. unsafe_word: This Word file contains macros, embedded files or active content. Save a clean DOCX or paste the text. password_pdf: This PDF is password protected. Remove the password from a copy or paste the text. scanned_pdf: This PDF has a page with no readable text. Use a text PDF, convert the scanned pages to text, or paste the text. page_limit: This PDF has more than 200 pages. Split it into smaller documents. archive_limit: This Word document expands beyond the safe size limit. Save a smaller DOCX or paste the text. parse_timeout: Reading this file took too long. Try a smaller document or paste the text.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. base_limit: This account has reached its knowledge base limit. session_limit: Too many test sessions today. Reuse an existing session. busy: Please wait for the existing knowledge jobs to finish. measure_busy: Other files are being checked. Please try again in a moment. training_limit: Today’s training allowance has been used. Your notes are saved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet. index_version: This knowledge index needs updating before it can be searched. deletion_pending: Private files are still being deleted. scan_unavailable: Safety check in progress. We will retry automatically. page_unavailable: This website is taking too long to reply. Try again later. provider_unavailable: Knowledge preparation and embeddings need to be configured. model_unconfigured: The knowledge preparation model and its context limit need to be configured. provider_unconfigured: Choose service or service for knowledge preparation. index_unavailable: The search index could not be prepared. test_unavailable: The test could not reply. Please try again. knowledge_loading: Knowledge is still loading — try again measure_unavailable: Counting took too long. Try a smaller source or try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/knowledge/jobs/{id}/cancel": {
      "post": {
        "operationId": "post_knowledge_jobs_id_cancel",
        "tags": [
          "Knowledge"
        ],
        "summary": "Cancel knowledge job",
        "description": "Cancel pending work before installation while keeping published knowledge. Cancellation is best effort before installation; it never reverses confirmed publication. Delete jobs cannot be cancelled after revocation. Terminal jobs return their existing state.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. delete_committed: Deletion has already revoked access and must finish. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true,
                "description": ""
              },
              "example": {}
            }
          }
        }
      }
    },
    "/knowledge/jobs/{id}/retry": {
      "post": {
        "operationId": "post_knowledge_jobs_id_retry",
        "tags": [
          "Knowledge"
        ],
        "summary": "Retry knowledge job",
        "description": "Retry a failed job when its revision and attempt limit still permit it. At most three processing attempts in total. Old revisions still refuse. An expired quarantined file needs a fresh upload. Safety retries use next_retry_at and do not spend the normal processing-attempt counter.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted; inspect the job before claiming completion.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "description": "Work type; includes import, discovery, publish, manual, export, delete and automatic-term maintenance."
                    },
                    "state": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "pending",
                        "running",
                        "needs_review",
                        "ready",
                        "failed",
                        "cancelled",
                        "deleted"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "description": "Current work stage, including reading, preparing, indexing, safety_check or safety_waiting."
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "integer",
                          "description": "Completed-stage progress, not elapsed-time prediction.",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "phase": {
                          "type": "string",
                          "description": "Reading or naming phase."
                        },
                        "page": {
                          "type": "integer",
                          "description": "Current page number."
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total input pages or entries."
                        },
                        "completed": {
                          "type": "integer",
                          "description": "Completed preparation units."
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total preparation units."
                        }
                      },
                      "required": [
                        "percent"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "draft_id": {
                          "type": "string",
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": ""
                          },
                          "description": ""
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "pages": {
                              "type": "integer",
                              "description": "Website pages processed."
                            },
                            "pieces": {
                              "type": "integer",
                              "description": "Prepared pieces."
                            },
                            "duplicates_skipped": {
                              "type": "integer",
                              "description": "Duplicate pieces or repeated source skipped."
                            }
                          },
                          "additionalProperties": true,
                          "description": ""
                        },
                        "unchanged": {
                          "type": "boolean",
                          "description": "No new publishable content was produced."
                        },
                        "revision": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Opaque identifier. Keep it as a string.",
                              "format": "uuid"
                            },
                            {
                              "type": "integer",
                              "description": "Integer revision for an export snapshot."
                            }
                          ]
                        },
                        "expected_revision": {
                          "type": "integer",
                          "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                          "minimum": 1
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": ""
                        },
                        "private_objects_remaining": {
                          "type": "integer",
                          "description": ""
                        },
                        "pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Discovery page ID, use exactly as returned."
                              },
                              "url": {
                                "type": "string",
                                "description": "Discovered public page URL."
                              },
                              "title": {
                                "type": "string",
                                "description": "Discovered page title."
                              }
                            },
                            "required": [
                              "id",
                              "url"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "Fields depend on job kind. Poll the job until a terminal state or needs_review; ready alone is not a claim that new text was published."
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable failure code; see the error catalog."
                        },
                        "message": {
                          "type": "string",
                          "description": "Display as escaped text; never execute or insert as HTML."
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "next_retry_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "paid_work_started": {
                      "type": "boolean",
                      "description": "Whether paid preparation work began; not an invoice or an additional charge."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "kb",
                    "kind",
                    "state",
                    "stage",
                    "progress",
                    "result",
                    "error",
                    "next_retry_at",
                    "paid_work_started",
                    "created_at"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. retry_unavailable: That file has expired. Upload it again or paste its text. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "410": {
            "description": "training_removed: Training has been removed. Edit a piece instead.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true,
                "description": ""
              },
              "example": {}
            }
          }
        }
      }
    },
    "/knowledge/targets": {
      "get": {
        "operationId": "get_knowledge_targets",
        "tags": [
          "Knowledge"
        ],
        "summary": "List knowledge agents",
        "description": "List active owned agents and their live knowledge state. Only active agents are listed. The API can manage API-origin agents; personal dashboard sessions hide an agent if any attached number is API-origin or unknown. target can restore a selected agent.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Maximum rows in this page.",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Opaque cursor from the prior response; omit for the first page.",
              "maxLength": 256
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Case-insensitive name or attached-number search.",
              "maxLength": 200
            }
          },
          {
            "name": "target",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Filter to one active owned agent ID."
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Only agent is supported.",
              "const": "agent"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Agent ID."
                          },
                          "kind": {
                            "type": "string",
                            "description": "",
                            "const": "agent"
                          },
                          "name": {
                            "type": "string",
                            "description": ""
                          },
                          "editorId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Dashboard record identifier."
                          },
                          "voice_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Older voice alias; prefer `voice_key`."
                          },
                          "topic_count": {
                            "type": "integer",
                            "description": ""
                          },
                          "live": {
                            "type": "boolean",
                            "description": "An active published revision exists."
                          },
                          "has_knowledge": {
                            "type": "boolean",
                            "description": "A ready knowledge base exists."
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "name",
                          "editorId",
                          "voice_id",
                          "topic_count",
                          "live",
                          "has_knowledge"
                        ],
                        "additionalProperties": true,
                        "description": ""
                      },
                      "description": ""
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Opaque cursor. Send it unchanged for the next page; null ends this list."
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/knowledge/test-sessions/{id}": {
      "get": {
        "operationId": "get_knowledge_test_sessions_id_",
        "tags": [
          "Knowledge"
        ],
        "summary": "Get knowledge test session",
        "description": "Read the saved knowledge-only conversation and its current state. Only the latest 100 messages are retained. Historical sessions remain readable; removed training modes are exposed as closed knowledge sessions. No notes or training controls are returned.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "owner": {
                      "type": "string",
                      "description": "Owning account ID."
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "expected_rev": {
                      "type": "integer",
                      "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                      "minimum": 1
                    },
                    "started_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "description": "",
                          "const": "knowledge"
                        },
                        "channel": {
                          "type": "string",
                          "description": "",
                          "enum": [
                            "inbound",
                            "outbound",
                            "web_voice",
                            "web_chat",
                            "sms"
                          ]
                        },
                        "draft_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "target": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "description": "",
                              "const": "agent"
                            },
                            "target": {
                              "type": "string",
                              "description": "Agent ID."
                            }
                          },
                          "required": [
                            "kind",
                            "target"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "messages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kb": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "role": {
                                "type": "string",
                                "description": "",
                                "enum": [
                                  "user",
                                  "assistant"
                                ]
                              },
                              "text": {
                                "type": "string",
                                "description": "Test conversation text."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              },
                              "selection": {
                                "type": "string",
                                "description": "",
                                "enum": [
                                  "whole_base",
                                  "search"
                                ]
                              },
                              "preview": {
                                "type": "boolean",
                                "description": ""
                              },
                              "simulated": {
                                "type": "boolean",
                                "description": "No call, text, booking or integration action runs."
                              },
                              "diagnostics": {
                                "type": "object",
                                "properties": {
                                  "mode": {
                                    "type": "string",
                                    "description": ""
                                  },
                                  "method": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": ""
                                  },
                                  "best_score": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "description": ""
                                  }
                                },
                                "additionalProperties": true,
                                "description": "API diagnostics only; these scores are not answer-correctness measurements."
                              }
                            },
                            "required": [
                              "id",
                              "role",
                              "text"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": "Latest 100 messages; questions are unlimited.",
                          "maxItems": 100
                        },
                        "state": {
                          "type": "string",
                          "description": "",
                          "enum": [
                            "active",
                            "cancelled",
                            "closed"
                          ]
                        },
                        "pending_message": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "mode",
                        "channel",
                        "draft_id",
                        "target",
                        "messages",
                        "state"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    }
                  },
                  "required": [
                    "id",
                    "owner",
                    "kb",
                    "expected_rev",
                    "started_at",
                    "data"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. target_changed: The selected knowledge changed. Start a new test.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/knowledge/test-sessions/{id}/cancel": {
      "post": {
        "operationId": "post_knowledge_test_sessions_id_cancel",
        "tags": [
          "Knowledge"
        ],
        "summary": "Cancel knowledge test",
        "description": "Cancel a simulated test session and related unfinished work. The session becomes cancelled; this never reverses an already published revision. Existing saved conversation remains readable.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "owner": {
                      "type": "string",
                      "description": "Owning account ID."
                    },
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "expected_rev": {
                      "type": "integer",
                      "description": "Latest integer revision read from this resource; it must still match when the request runs.",
                      "minimum": 1
                    },
                    "started_at": {
                      "type": "string",
                      "description": "UTC timestamp.",
                      "format": "date-time"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "description": "",
                          "const": "knowledge"
                        },
                        "channel": {
                          "type": "string",
                          "description": "",
                          "enum": [
                            "inbound",
                            "outbound",
                            "web_voice",
                            "web_chat",
                            "sms"
                          ]
                        },
                        "draft_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        },
                        "target": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "description": "",
                              "const": "agent"
                            },
                            "target": {
                              "type": "string",
                              "description": "Agent ID."
                            }
                          },
                          "required": [
                            "kind",
                            "target"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "messages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kb": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "id": {
                                "type": "string",
                                "description": "Opaque identifier. Keep it as a string.",
                                "format": "uuid"
                              },
                              "role": {
                                "type": "string",
                                "description": "",
                                "enum": [
                                  "user",
                                  "assistant"
                                ]
                              },
                              "text": {
                                "type": "string",
                                "description": "Test conversation text."
                              },
                              "evidence": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "segment": {
                                      "type": "integer",
                                      "description": "Source segment index."
                                    },
                                    "quote": {
                                      "type": "string",
                                      "description": "Original evidence text."
                                    },
                                    "quote_hash": {
                                      "type": "string",
                                      "description": "Digest used by a deletion record."
                                    },
                                    "topic_id": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "revision": {
                                      "type": "string",
                                      "description": "Opaque identifier. Keep it as a string.",
                                      "format": "uuid"
                                    },
                                    "title": {
                                      "type": "string",
                                      "description": "Title snapshot at answer time."
                                    }
                                  },
                                  "additionalProperties": true,
                                  "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                                },
                                "description": ""
                              },
                              "selection": {
                                "type": "string",
                                "description": "",
                                "enum": [
                                  "whole_base",
                                  "search"
                                ]
                              },
                              "preview": {
                                "type": "boolean",
                                "description": ""
                              },
                              "simulated": {
                                "type": "boolean",
                                "description": "No call, text, booking or integration action runs."
                              },
                              "diagnostics": {
                                "type": "object",
                                "properties": {
                                  "mode": {
                                    "type": "string",
                                    "description": ""
                                  },
                                  "method": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": ""
                                  },
                                  "best_score": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "description": ""
                                  }
                                },
                                "additionalProperties": true,
                                "description": "API diagnostics only; these scores are not answer-correctness measurements."
                              }
                            },
                            "required": [
                              "id",
                              "role",
                              "text"
                            ],
                            "additionalProperties": true,
                            "description": ""
                          },
                          "description": "Latest 100 messages; questions are unlimited.",
                          "maxItems": 100
                        },
                        "state": {
                          "type": "string",
                          "description": "",
                          "enum": [
                            "active",
                            "cancelled",
                            "closed"
                          ]
                        },
                        "pending_message": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Opaque identifier. Keep it as a string.",
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "mode",
                        "channel",
                        "draft_id",
                        "target",
                        "messages",
                        "state"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    }
                  },
                  "required": [
                    "id",
                    "owner",
                    "kb",
                    "expected_rev",
                    "started_at",
                    "data"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. target_changed: The selected knowledge changed. Start a new test. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": true,
                "description": ""
              },
              "example": {}
            }
          }
        }
      }
    },
    "/knowledge/test-sessions/{id}/messages": {
      "post": {
        "operationId": "post_knowledge_test_sessions_id_messages",
        "tags": [
          "Knowledge"
        ],
        "summary": "Ask a knowledge test question",
        "description": "Ask a simulated question using current knowledge and return supplied-piece evidence. Every question reads current knowledge. A durable Idempotency-Key reservation prevents duplicate model work. If the result is pending, read the session before retrying. No tool, call, SMS, booking or integration action runs. Questions are unlimited; the latest 100 messages remain. Small bases supply all valid pieces, so evidence is context supplied rather than proof of relevance.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Unique 8–128-character operation key: letters, numbers, dot, underscore, colon or hyphen. The prompt: prefix is reserved. Reuse only with the identical operation and payload.",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]{8,128}$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kb": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "id": {
                      "type": "string",
                      "description": "Opaque identifier. Keep it as a string.",
                      "format": "uuid"
                    },
                    "role": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "user",
                        "assistant"
                      ]
                    },
                    "text": {
                      "type": "string",
                      "description": "Test conversation text."
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "segment": {
                            "type": "integer",
                            "description": "Source segment index."
                          },
                          "quote": {
                            "type": "string",
                            "description": "Original evidence text."
                          },
                          "quote_hash": {
                            "type": "string",
                            "description": "Digest used by a deletion record."
                          },
                          "topic_id": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "revision": {
                            "type": "string",
                            "description": "Opaque identifier. Keep it as a string.",
                            "format": "uuid"
                          },
                          "title": {
                            "type": "string",
                            "description": "Title snapshot at answer time."
                          }
                        },
                        "additionalProperties": true,
                        "description": "Evidence fields vary by source, topic or answer. IDs identify supplied context, not proof that every piece affected an answer."
                      },
                      "description": ""
                    },
                    "selection": {
                      "type": "string",
                      "description": "",
                      "enum": [
                        "whole_base",
                        "search"
                      ]
                    },
                    "preview": {
                      "type": "boolean",
                      "description": ""
                    },
                    "simulated": {
                      "type": "boolean",
                      "description": "No call, text, booking or integration action runs."
                    },
                    "diagnostics": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "description": ""
                        },
                        "method": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": ""
                        },
                        "best_score": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": "API diagnostics only; these scores are not answer-correctness measurements."
                    }
                  },
                  "required": [
                    "id",
                    "role",
                    "text"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again. invalid_body: The request body could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted. target_changed: The selected knowledge changed. Start a new test. session_closed: Start a new knowledge test. message_busy: Wait for the current test reply. message_in_progress: This test reply is still pending. Read the session before retrying. draft_changed: The preview changed. Reopen the review to test it. knowledge_updating: Knowledge is still changing. Your test is saved; ask again in a moment. idempotency_conflict: Use a new Idempotency-Key for different information. stale_revision: The list changed. Reload it to see the latest pieces.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "storage_limit: Your account has reached its private storage limit. Remove old sources first. invalid_body: The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet. knowledge_loading: Knowledge is still loading — try again test_unavailable: The test could not reply. Please try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Nonblank question text.",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                },
                "required": [
                  "text"
                ],
                "additionalProperties": true,
                "description": ""
              },
              "example": {
                "text": "When are appointments available?"
              }
            }
          }
        }
      }
    },
    "/knowledge/usage": {
      "get": {
        "operationId": "get_knowledge_usage",
        "tags": [
          "Knowledge"
        ],
        "summary": "Get knowledge usage",
        "description": "Read private storage inventory and compatibility allowance counters. The optional kb filters the per-base compatibility allowance after ownership checks. Inventory remains account-wide. Read the authoritative reset timestamp; removed training counters do not re-enable training.",
        "parameters": [
          {
            "name": "kb",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Opaque identifier. Keep it as a string.",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "quota": {
                      "type": "object",
                      "properties": {
                        "remaining_today": {
                          "type": "integer",
                          "description": "Per-base training units from the removed training feature."
                        },
                        "account_remaining": {
                          "type": "integer",
                          "description": "Account training units from the removed training feature."
                        },
                        "resets_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "starts_at": {
                          "type": "string",
                          "description": "UTC timestamp.",
                          "format": "date-time"
                        },
                        "timezone": {
                          "type": "string",
                          "description": "Account reset timezone."
                        }
                      },
                      "required": [
                        "remaining_today",
                        "account_remaining",
                        "resets_at",
                        "starts_at",
                        "timezone"
                      ],
                      "additionalProperties": true,
                      "description": ""
                    },
                    "inventory": {
                      "type": "object",
                      "properties": {
                        "bases": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "policies": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "sources": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "objects": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "revisions": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "topics": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "drafts": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "sessions": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "jobs": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "idempotency": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "events": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        },
                        "accounts": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "description": "Owned row count."
                            }
                          },
                          "required": [
                            "count"
                          ],
                          "additionalProperties": true,
                          "description": ""
                        }
                      },
                      "additionalProperties": true,
                      "description": ""
                    },
                    "billing": {
                      "type": "string",
                      "description": "Compatibility billing text; not a new charge."
                    }
                  },
                  "required": [
                    "quota",
                    "inventory",
                    "billing"
                  ],
                  "additionalProperties": true,
                  "description": ""
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agents/{target}/knowledge-keyterms": {
      "get": {
        "operationId": "get_agents_target_knowledge_keyterms",
        "tags": [
          "Knowledge"
        ],
        "summary": "Read automatic keyterms",
        "description": "Read ranked automatic speech terms from an agent’s current live knowledge. This dedicated read returns automatic keyterms. Agent list/detail reads also expose knowledge_keyterms when knowledge is enabled and filter against saved customer words. The dedicated read does not take an edited manual list; clients filter automatic keyterms against their current edited customer terms. Customer terms always take priority on calls. Only valid, unsuppressed, currently applicable live pieces contribute; drafts and raw sources do not. The read returns all six fields. Counts equal their returned array lengths. The automatic list is before call transport limits and is not filtered against unsaved manual form values. Legacy saved manual lists can exceed the edit limit. Treat both lists as read-only observations.",
        "parameters": [
          {
            "name": "target",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Owned agent ID. URL-encode it as a path segment."
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "knowledge_keyterms": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "Source-spelled term."
                      },
                      "description": "Ranked automatic keyterms; default cap 80 per agent, set by Nixflex between 0 and 100.",
                      "maxItems": 100
                    },
                    "knowledge_keyterms_count": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Length of knowledge_keyterms."
                    },
                    "knowledge_keyterms_limit": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 100,
                      "description": "Configured automatic keyterm limit; default 80."
                    },
                    "manual_keyterms": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Saved customer entries, trimmed and nonempty. Compare with unsaved form values in your UI."
                    },
                    "manual_keyterms_count": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Length of manual_keyterms; an unchanged legacy list can exceed today’s edit limit."
                    },
                    "manual_keyterms_limit": {
                      "type": "integer",
                      "const": 20,
                      "description": "Maximum nonempty terms for newly edited manual lists; unchanged saved lists may exceed this value."
                    }
                  },
                  "required": [
                    "knowledge_keyterms",
                    "knowledge_keyterms_count",
                    "knowledge_keyterms_limit",
                    "manual_keyterms",
                    "manual_keyterms_count",
                    "manual_keyterms_limit"
                  ],
                  "additionalProperties": true,
                  "description": ""
                },
                "example": {
                  "knowledge_keyterms": [
                    "Evening appointments"
                  ],
                  "knowledge_keyterms_count": 1,
                  "knowledge_keyterms_limit": 80,
                  "manual_keyterms": [],
                  "manual_keyterms_count": 0,
                  "manual_keyterms_limit": 20
                }
              }
            }
          },
          "400": {
            "description": "invalid_input: Check the information and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Your personal role does not allow this action. membership_revoked: Your membership has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: That topic is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "deleting: This knowledge base is being deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "unavailable: Knowledge is unavailable right now. Your saved information is safe. Try again. knowledge_unconfigured: Knowledge is not available yet. knowledge_not_released: Knowledge is not released yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/integrations/google-calendar/number/{phoneNumber}/connect": {
      "post": {
        "operationId": "connectNumberGoogleCalendar",
        "summary": "Connect Google Calendar",
        "description": "Organisation API key or verified dashboard session. Owner/Admin can write; Member can read. Other organisations cannot access this number.",
        "tags": [
          "Google Calendar"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "description": "Owned E.164 number. URL-encode the leading +.",
            "schema": {
              "type": "string",
              "pattern": "^\\+[1-9][0-9]{1,14}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "return_url": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "HTTPS return URL, or an app scheme that Nixflex support has approved for your organisation. No credentials, fragment, whitespace or OAuth-secret query parameters."
                  }
                },
                "required": [
                  "return_url"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Cache-Control: no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "url",
                    "expires_at"
                  ]
                },
                "example": {
                  "url": "https://accounts.google.com/o/oauth2/v2/auth?state=example",
                  "expires_at": "2030-11-04T10:10:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "invalid_return_url. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "permission_denied, account_unavailable. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "number_not_found. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "already_connected, booking_provider_conflict, agent_not_assigned, expired_link. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "calendar_unavailable, not_configured, guard_unavailable. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/integrations/google-calendar/number/{phoneNumber}": {
      "get": {
        "operationId": "getNumberGoogleCalendar",
        "summary": "Get Google Calendar status",
        "description": "Organisation API key or verified dashboard session. Owner/Admin can write; Member can read. Other organisations cannot access this number.",
        "tags": [
          "Google Calendar"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "description": "Owned E.164 number. URL-encode the leading +.",
            "schema": {
              "type": "string",
              "pattern": "^\\+[1-9][0-9]{1,14}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Cache-Control: no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connected": {
                      "type": "boolean"
                    },
                    "account_email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "calendar_id": {
                      "type": "string"
                    },
                    "connected_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "needs_reconnect": {
                      "type": "boolean"
                    },
                    "send_invites": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "connected",
                    "account_email",
                    "calendar_id",
                    "connected_at",
                    "needs_reconnect",
                    "send_invites"
                  ]
                },
                "example": {
                  "connected": false,
                  "account_email": null,
                  "calendar_id": "primary",
                  "connected_at": null,
                  "needs_reconnect": false,
                  "send_invites": true
                }
              }
            }
          },
          "401": {
            "description": "unauthorized. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "permission_denied, account_unavailable. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "number_not_found. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "calendar_unavailable. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "disconnectNumberGoogleCalendar",
        "summary": "Disconnect Google Calendar",
        "description": "Organisation API key or verified dashboard session. Owner/Admin can write; Member can read. Other organisations cannot access this number.",
        "tags": [
          "Google Calendar"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "description": "Owned E.164 number. URL-encode the leading +.",
            "schema": {
              "type": "string",
              "pattern": "^\\+[1-9][0-9]{1,14}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Cache-Control: no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "connected": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "ok",
                    "connected"
                  ]
                },
                "example": {
                  "ok": true,
                  "connected": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "permission_denied, account_unavailable. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "number_not_found. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "expired_link. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "calendar_unavailable. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateNumberGoogleCalendarSettings",
        "summary": "Update Google Calendar settings",
        "description": "Organisation API key or verified dashboard session. Owner/Admin can write; Member can read. Other organisations cannot access this number.",
        "tags": [
          "Google Calendar"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "description": "Owned E.164 number. URL-encode the leading +.",
            "schema": {
              "type": "string",
              "pattern": "^\\+[1-9][0-9]{1,14}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "timezone": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "IANA timezone. Explicit per-number timezone wins; older settings can inherit the agent timezone."
                  },
                  "hours": {
                    "type": "object",
                    "properties": {
                      "monday": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 2,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                            }
                          }
                        ],
                        "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                      },
                      "tuesday": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 2,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                            }
                          }
                        ],
                        "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                      },
                      "wednesday": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 2,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                            }
                          }
                        ],
                        "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                      },
                      "thursday": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 2,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                            }
                          }
                        ],
                        "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                      },
                      "friday": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 2,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                            }
                          }
                        ],
                        "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                      },
                      "saturday": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 2,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                            }
                          }
                        ],
                        "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                      },
                      "sunday": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 2,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                            }
                          }
                        ],
                        "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                      }
                    },
                    "required": [
                      "monday",
                      "tuesday",
                      "wednesday",
                      "thursday",
                      "friday",
                      "saturday",
                      "sunday"
                    ],
                    "additionalProperties": false,
                    "description": "Replace the entire seven-day map. Omit to retain saved hours."
                  },
                  "slot_minutes": {
                    "type": "integer",
                    "enum": [
                      15,
                      30,
                      45,
                      60
                    ],
                    "description": "Older connections default to 30 minutes."
                  },
                  "calendar_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024,
                    "pattern": "^[^\\s\\x00-\\x1f\\x7f]+$",
                    "description": "Editable calendar ID; primary by default."
                  },
                  "send_invites": {
                    "type": "boolean",
                    "description": "Defaults to true when not previously stored. Omission on PATCH preserves the setting. Google controls delivery."
                  }
                },
                "minProperties": 1,
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Cache-Control: no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "timezone": {
                      "type": "string",
                      "maxLength": 100,
                      "description": "IANA timezone. Explicit per-number timezone wins; older settings can inherit the agent timezone."
                    },
                    "hours": {
                      "type": "object",
                      "properties": {
                        "monday": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": {
                                "type": "string",
                                "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                              }
                            }
                          ],
                          "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                        },
                        "tuesday": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": {
                                "type": "string",
                                "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                              }
                            }
                          ],
                          "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                        },
                        "wednesday": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": {
                                "type": "string",
                                "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                              }
                            }
                          ],
                          "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                        },
                        "thursday": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": {
                                "type": "string",
                                "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                              }
                            }
                          ],
                          "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                        },
                        "friday": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": {
                                "type": "string",
                                "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                              }
                            }
                          ],
                          "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                        },
                        "saturday": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": {
                                "type": "string",
                                "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                              }
                            }
                          ],
                          "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                        },
                        "sunday": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "array",
                              "minItems": 2,
                              "maxItems": 2,
                              "items": {
                                "type": "string",
                                "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                              }
                            }
                          ],
                          "description": "Null when closed; otherwise [opening, closing], with closing strictly after opening on the same day."
                        }
                      },
                      "required": [
                        "monday",
                        "tuesday",
                        "wednesday",
                        "thursday",
                        "friday",
                        "saturday",
                        "sunday"
                      ],
                      "additionalProperties": false,
                      "description": "Replace the entire seven-day map. Omit to retain saved hours."
                    },
                    "slot_minutes": {
                      "type": "integer",
                      "enum": [
                        15,
                        30,
                        45,
                        60
                      ],
                      "description": "Older connections default to 30 minutes."
                    },
                    "calendar_id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1024,
                      "pattern": "^[^\\s\\x00-\\x1f\\x7f]+$",
                      "description": "Editable calendar ID; primary by default."
                    },
                    "send_invites": {
                      "type": "boolean",
                      "description": "Defaults to true when not previously stored. Omission on PATCH preserves the setting. Google controls delivery."
                    }
                  },
                  "required": [
                    "timezone",
                    "hours",
                    "slot_minutes",
                    "calendar_id",
                    "send_invites"
                  ]
                },
                "example": {
                  "timezone": "Europe/London",
                  "hours": {
                    "monday": [
                      "09:00",
                      "17:00"
                    ],
                    "tuesday": [
                      "09:00",
                      "17:00"
                    ],
                    "wednesday": [
                      "09:00",
                      "17:00"
                    ],
                    "thursday": [
                      "09:00",
                      "17:00"
                    ],
                    "friday": [
                      "09:00",
                      "17:00"
                    ],
                    "saturday": null,
                    "sunday": null
                  },
                  "slot_minutes": 30,
                  "calendar_id": "primary",
                  "send_invites": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_settings, invalid_timezone, invalid_hours, invalid_slot_minutes, invalid_calendar_id, invalid_send_invites. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "permission_denied, account_unavailable. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "number_not_found. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "not_connected, expired_link. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "calendar_unavailable. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/phone-numbers/{phoneNumber}/credentials": {
      "post": {
        "operationId": "updatePhoneNumberCredentials",
        "summary": "Update phone number credentials",
        "description": "Organisation API key or verified dashboard session. Owner/Admin can write; Member can read. Other organisations cannot access this number.",
        "tags": [
          "Phone numbers"
        ],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "description": "Owned E.164 number. URL-encode the leading +.",
            "schema": {
              "type": "string",
              "pattern": "^\\+[1-9][0-9]{1,14}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "twilio_sid": {
                        "type": "string",
                        "pattern": "^AC[a-fA-F0-9]{32}$",
                        "writeOnly": true
                      },
                      "twilio_token": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4096,
                        "pattern": "^(?=[^\\r\\n\\u0000]*\\S)[^\\r\\n\\u0000]+$",
                        "writeOnly": true,
                        "description": "Private submitted credential. Outer whitespace is trimmed; blank values and CR/LF/NUL are refused."
                      }
                    },
                    "required": [
                      "twilio_sid",
                      "twilio_token"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "telnyx_api_key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4096,
                        "pattern": "^(?=[^\\r\\n\\u0000]*\\S)[^\\r\\n\\u0000]+$",
                        "writeOnly": true,
                        "description": "Private submitted credential. Outer whitespace is trimmed; blank values and CR/LF/NUL are refused."
                      },
                      "telnyx_connection_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200,
                        "pattern": "^(?=[^\\r\\n\\u0000]*\\S)[^\\r\\n\\u0000]+$",
                        "writeOnly": true,
                        "description": "Your existing TeXML app connection ID."
                      }
                    },
                    "required": [
                      "telnyx_api_key",
                      "telnyx_connection_id"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Cache-Control: no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string",
                      "pattern": "^\\+[1-9][0-9]{1,14}$"
                    },
                    "provider": {
                      "type": "string",
                      "enum": [
                        "twilio",
                        "telnyx"
                      ]
                    },
                    "updated": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "phone_number",
                    "provider",
                    "updated"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "phone_number": "+12025550123",
                  "provider": "twilio",
                  "updated": true
                }
              }
            }
          },
          "400": {
            "description": "invalid_request, invalid_credentials. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "permission_denied, account_unavailable. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "number_not_found, number_not_in_account. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "carrier_mismatch, number_operation_pending, number_release_pending. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "carrier_unavailable, credential_update_unavailable, carrier_outcome_unknown, credential_save_pending. Standard error envelope; branch on error.code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/calls/{id}/bookings": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Read call booking results",
        "operationId": "getCallBookings",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Read the authoritative retained booking result for one owned call. ready returns the signed-event public projection as data, not a delivery signature. none requires confirmed completed evidence with no successful mutations. processing means unfinished tracked work. deleted covers deleted, immediately scheduled, expired or purging content. unavailable covers old, partial, unstamped or unconfirmed evidence, including terminal unsuccessful calls. Do not infer bookings from a transcript or recover erased data from logs. This is the result of this call, not current calendar inventory.",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Owned call identifier. Invalid, missing and foreign identifiers share the same 404.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Booking state. Only ready returns a non-null result.",
            "headers": {
              "Cache-Control": {
                "description": "Do not cache private request or booking state.",
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "call_id",
                        "state",
                        "result"
                      ],
                      "additionalProperties": true,
                      "properties": {
                        "call_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "state": {
                          "type": "string",
                          "const": "ready"
                        },
                        "result": {
                          "type": "object",
                          "additionalProperties": true,
                          "required": [
                            "event",
                            "call_id",
                            "agent_id",
                            "from",
                            "to",
                            "number",
                            "ended_at",
                            "timeline",
                            "final"
                          ],
                          "properties": {
                            "event": {
                              "type": "string",
                              "const": "call.bookings"
                            },
                            "call_id": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "agent_id": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "from": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "to": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "number": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "ended_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Engine call-end time in UTC; not webhook delivery time."
                            },
                            "timeline": {
                              "type": "array",
                              "minItems": 1,
                              "description": "Ordered confirmed calendar mutations during this call.",
                              "items": {
                                "type": "object",
                                "additionalProperties": true,
                                "required": [
                                  "action",
                                  "booking_uid",
                                  "start",
                                  "end",
                                  "attendee_name",
                                  "attendee_email",
                                  "service",
                                  "timezone",
                                  "at"
                                ],
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "enum": [
                                      "created",
                                      "rescheduled",
                                      "cancelled"
                                    ]
                                  },
                                  "booking_uid": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "start": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "end": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "attendee_name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "attendee_email": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "service": {
                                    "type": [
                                      "string",
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "timezone": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "Engine receipt time of the successful mutation, in UTC."
                                  }
                                }
                              }
                            },
                            "final": {
                              "type": "array",
                              "minItems": 1,
                              "description": "One result per resulting booking UID. This is not a full calendar inventory.",
                              "items": {
                                "type": "object",
                                "additionalProperties": true,
                                "required": [
                                  "status",
                                  "booking_uid",
                                  "start",
                                  "end",
                                  "attendee_name",
                                  "attendee_email",
                                  "service",
                                  "timezone"
                                ],
                                "properties": {
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "active",
                                      "cancelled"
                                    ]
                                  },
                                  "booking_uid": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "start": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "end": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "attendee_name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "attendee_email": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "service": {
                                    "type": [
                                      "string",
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "timezone": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "call_id",
                        "state",
                        "result"
                      ],
                      "additionalProperties": true,
                      "properties": {
                        "call_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "state": {
                          "type": "string",
                          "const": "none"
                        },
                        "result": {
                          "type": "null",
                          "description": "No authoritative booking result is returned in this state."
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "call_id",
                        "state",
                        "result"
                      ],
                      "additionalProperties": true,
                      "properties": {
                        "call_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "state": {
                          "type": "string",
                          "const": "processing"
                        },
                        "result": {
                          "type": "null",
                          "description": "No authoritative booking result is returned in this state."
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "call_id",
                        "state",
                        "result"
                      ],
                      "additionalProperties": true,
                      "properties": {
                        "call_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "state": {
                          "type": "string",
                          "const": "deleted"
                        },
                        "result": {
                          "type": "null",
                          "description": "No authoritative booking result is returned in this state."
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "call_id",
                        "state",
                        "result"
                      ],
                      "additionalProperties": true,
                      "properties": {
                        "call_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "state": {
                          "type": "string",
                          "const": "unavailable"
                        },
                        "result": {
                          "type": "null",
                          "description": "No authoritative booking result is returned in this state."
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "ready": {
                    "summary": "Confirmed mutations and their final results.",
                    "value": {
                      "call_id": "call_example",
                      "state": "ready",
                      "result": {
                        "event": "call.bookings",
                        "call_id": "call_example",
                        "agent_id": "agent_example",
                        "from": "+12025550101",
                        "to": "+12025550100",
                        "number": "+12025550100",
                        "ended_at": "2030-11-04T09:05:00.000Z",
                        "timeline": [
                          {
                            "action": "created",
                            "booking_uid": "booking_example",
                            "start": "2030-11-04T10:00:00.000Z",
                            "end": "2030-11-04T10:30:00.000Z",
                            "attendee_name": "Sam Carter",
                            "attendee_email": "sam@example.test",
                            "service": "Consultation",
                            "timezone": "Europe/London",
                            "at": "2030-11-04T09:01:00.000Z"
                          },
                          {
                            "action": "rescheduled",
                            "booking_uid": "booking_example",
                            "start": "2030-11-04T11:00:00.000Z",
                            "end": "2030-11-04T11:30:00.000Z",
                            "attendee_name": "Sam Carter",
                            "attendee_email": "sam@example.test",
                            "service": "Consultation",
                            "timezone": "Europe/London",
                            "at": "2030-11-04T09:02:00.000Z"
                          }
                        ],
                        "final": [
                          {
                            "status": "active",
                            "booking_uid": "booking_example",
                            "start": "2030-11-04T11:00:00.000Z",
                            "end": "2030-11-04T11:30:00.000Z",
                            "attendee_name": "Sam Carter",
                            "attendee_email": "sam@example.test",
                            "service": "Consultation",
                            "timezone": "Europe/London"
                          }
                        ]
                      }
                    }
                  },
                  "none": {
                    "summary": "Completed booking evidence confirms no successful mutation.",
                    "value": {
                      "call_id": "call_example",
                      "state": "none",
                      "result": null
                    }
                  },
                  "processing": {
                    "summary": "Tracked call or post-call work is still running.",
                    "value": {
                      "call_id": "call_example",
                      "state": "processing",
                      "result": null
                    }
                  },
                  "deleted": {
                    "summary": "Retained booking content is no longer available.",
                    "value": {
                      "call_id": "call_example",
                      "state": "deleted",
                      "result": null
                    }
                  },
                  "unavailable": {
                    "summary": "The retained evidence cannot establish a result.",
                    "value": {
                      "call_id": "call_example",
                      "state": "unavailable",
                      "result": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The account or personal session cannot access this operation. Resolve access through an authorised person.",
            "headers": {
              "Cache-Control": {
                "description": "Do not cache private request or booking state.",
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "permission": {
                    "value": {
                      "error": {
                        "type": "permission_denied",
                        "code": "permission_denied",
                        "message": "You do not have access to this section.",
                        "doc_url": "https://docs.nixflex.com/errors/permission_denied",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: Call identifier is invalid, missing or foreign. Check the owned ID.",
            "headers": {
              "Cache-Control": {
                "description": "Do not cache private request or booking state.",
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "not_found"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "not_found": {
                    "value": {
                      "error": {
                        "type": "not_found",
                        "code": "not_found",
                        "message": "Call not found.",
                        "doc_url": "https://docs.nixflex.com/errors/not_found",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "call_bookings_unavailable: The read failed. Retry the read with bounded backoff; never show none.",
            "headers": {
              "Cache-Control": {
                "description": "Do not cache private request or booking state.",
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "call_bookings_unavailable"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "unavailable": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "call_bookings_unavailable",
                        "message": "The booking result could not be checked. Try again shortly.",
                        "doc_url": "https://docs.nixflex.com/errors/call_bookings_unavailable",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/calls/outbound/requests/{request_id}": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Read an outbound call request",
        "operationId": "getOutboundCallRequest",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Read the durable state of one account-scoped outbound request UUID. This does not dispatch, reserve capacity or charge. Pending records display unknown after 15 minutes and are never recycled. A 404 is shared by invalid, absent and foreign IDs; it is not evidence that an uncertain call is safe to redial. Preserve the request ID across lost responses and process restarts.",
        "parameters": [
          {
            "in": "path",
            "name": "request_id",
            "required": true,
            "description": "The UUID saved for the original call intent.",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
              "description": "Account-scoped UUID for one call intent. Save it before sending. Reusing it never starts a second call; changed input conflicts."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current request state; call_id and reason can be null.",
            "headers": {
              "Cache-Control": {
                "description": "Do not cache private request or booking state.",
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "request_id",
                    "state",
                    "call_id",
                    "reason"
                  ],
                  "additionalProperties": true,
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
                      "description": "Account-scoped UUID for one call intent. Save it before sending. Reusing it never starts a second call; changed input conflicts."
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "rejected",
                        "unknown"
                      ]
                    },
                    "call_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Known call identifier, or null. Unknown does not confirm that no call was placed."
                    },
                    "reason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Bounded machine-readable refusal/failure reason when retained; otherwise null."
                    }
                  }
                },
                "examples": {
                  "pending": {
                    "value": {
                      "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
                      "state": "pending",
                      "call_id": null,
                      "reason": null
                    }
                  },
                  "accepted": {
                    "value": {
                      "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
                      "state": "accepted",
                      "call_id": "call_example",
                      "reason": null
                    }
                  },
                  "rejected": {
                    "value": {
                      "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
                      "state": "rejected",
                      "call_id": null,
                      "reason": "outside_hours"
                    }
                  },
                  "unknown": {
                    "value": {
                      "request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
                      "state": "unknown",
                      "call_id": null,
                      "reason": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid. Check the full account credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The account or personal session cannot access this operation. Resolve access through an authorised person.",
            "headers": {
              "Cache-Control": {
                "description": "Do not cache private request or booking state.",
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "permission": {
                    "value": {
                      "error": {
                        "type": "permission_denied",
                        "code": "permission_denied",
                        "message": "You do not have access to this section.",
                        "doc_url": "https://docs.nixflex.com/errors/permission_denied",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: UUID is invalid, missing or foreign. Reconcile the original intent; do not automatically redial.",
            "headers": {
              "Cache-Control": {
                "description": "Do not cache private request or booking state.",
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "not_found"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "not_found": {
                    "value": {
                      "error": {
                        "type": "not_found",
                        "code": "not_found",
                        "message": "Request not found.",
                        "doc_url": "https://docs.nixflex.com/errors/not_found",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached. Wait for Retry-After. Reconcile uncertain writes before resending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error class."
                        },
                        "code": {
                          "type": "string",
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Readable refusal or failure reason."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error documentation URL.",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Additional field, operation or outcome details.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "outbound_request_unavailable: The status read failed. Keep the previous uncertainty and retry the read.",
            "headers": {
              "Cache-Control": {
                "description": "Do not cache private request or booking state.",
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "outbound_request_unavailable"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "unavailable": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "outbound_request_unavailable",
                        "message": "The call request could not be checked. Try again shortly.",
                        "doc_url": "https://docs.nixflex.com/errors/outbound_request_unavailable",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/campaigns/{id}": {
      "get": {
        "tags": [
          "Voice campaigns"
        ],
        "summary": "Get a voice campaign",
        "operationId": "getVoiceCampaign",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Read one owned voice campaign with the same fields as a campaign-list item. No recipients are included. Wider-hours confirmation uses current saved evidence; an evidence-read failure returns 503 rather than false. Missing, foreign, deleted and invalid IDs have the same 404. Responses use Cache-Control: no-store.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Exact owned campaign identifier. Invalid, missing, foreign and deleted IDs share a 404.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owned campaign detail.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "campaign"
                  ],
                  "properties": {
                    "campaign": {
                      "type": "object",
                      "properties": {
                        "campaign_id": {
                          "type": "string",
                          "description": "Public campaign ID."
                        },
                        "agent_id": {
                          "type": "string",
                          "description": "Owning agent ID."
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved campaign label."
                        },
                        "from_number": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "International number with + and digits; no spaces.",
                          "pattern": "^\\+[1-9][0-9]{6,14}$"
                        },
                        "schedule_type": {
                          "type": "string",
                          "description": "Saved now or schedule mode."
                        },
                        "scheduled_date": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved scheduled date."
                        },
                        "window_start_minutes": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Configured start minute."
                        },
                        "window_end_minutes": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Configured end minute."
                        },
                        "window_days": {
                          "type": [
                            "array",
                            "null"
                          ],
                          "items": {
                            "type": "string",
                            "description": "Weekday."
                          },
                          "description": ""
                        },
                        "timezone": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved campaign time zone."
                        },
                        "source": {
                          "type": "string",
                          "description": "Saved origin label."
                        },
                        "status": {
                          "type": "string",
                          "description": "Current state; for example scheduled, launching, running, done, failed or cancelled. Treat new states conservatively."
                        },
                        "total_count": {
                          "type": "integer",
                          "description": "Count.",
                          "minimum": 0
                        },
                        "started_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved timestamp, or null.",
                          "format": "date-time"
                        },
                        "completed_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved timestamp, or null.",
                          "format": "date-time"
                        },
                        "created_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved timestamp, or null.",
                          "format": "date-time"
                        },
                        "updated_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Saved timestamp, or null.",
                          "format": "date-time"
                        },
                        "allow_wider_hours": {
                          "type": "boolean",
                          "description": "True only with confirmation evidence for the current policy revision."
                        },
                        "prompt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Default voice instructions."
                        },
                        "done_count": {
                          "type": "integer",
                          "description": "Count.",
                          "minimum": 0
                        },
                        "failed_count": {
                          "type": "integer",
                          "description": "Count.",
                          "minimum": 0
                        },
                        "voicemail_count": {
                          "type": "integer",
                          "description": "Count.",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "campaign_id",
                        "agent_id",
                        "name",
                        "from_number",
                        "schedule_type",
                        "scheduled_date",
                        "window_start_minutes",
                        "window_end_minutes",
                        "window_days",
                        "timezone",
                        "source",
                        "status",
                        "total_count",
                        "started_at",
                        "completed_at",
                        "created_at",
                        "updated_at",
                        "allow_wider_hours",
                        "prompt",
                        "done_count",
                        "failed_count",
                        "voicemail_count"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "campaign": {
                    "value": {
                      "campaign": {
                        "campaign_id": "campaign_example",
                        "agent_id": "agent_example",
                        "name": "Appointment reminders",
                        "prompt": null,
                        "from_number": "+12025550123",
                        "schedule_type": "schedule",
                        "scheduled_date": "2026-11-20",
                        "window_start_minutes": 540,
                        "window_end_minutes": 1020,
                        "window_days": [
                          "mon",
                          "tue",
                          "wed",
                          "thu",
                          "fri"
                        ],
                        "timezone": "America/New_York",
                        "source": "api",
                        "status": "scheduled",
                        "total_count": 10,
                        "done_count": 0,
                        "failed_count": 0,
                        "voicemail_count": 0,
                        "started_at": null,
                        "completed_at": null,
                        "created_at": "2026-11-12T00:00:00Z",
                        "updated_at": "2026-11-12T00:00:00Z",
                        "allow_wider_hours": false
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "description": "Do not store this response.",
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: The credential is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: The authenticated principal is not allowed to access this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "permission_denied"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "permission_denied": {
                    "value": {
                      "error": {
                        "type": "permission_denied",
                        "code": "permission_denied",
                        "message": "You do not have permission to do this.",
                        "doc_url": "https://docs.nixflex.com/errors/permission_denied",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: Invalid, missing, foreign or deleted campaign.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "not_found"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "not_found": {
                    "value": {
                      "error": {
                        "type": "not_found",
                        "code": "not_found",
                        "message": "Campaign not found.",
                        "doc_url": "https://docs.nixflex.com/errors/not_found",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limit_exceeded: The account request limit was reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Explanation."
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "Error reference link."
                        },
                        "details": {
                          "type": "object",
                          "properties": {},
                          "description": "Optional context; inspect campaign_id, status, outcome and safe_to_retry for uncertain writes.",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "doc_url",
                        "type"
                      ],
                      "description": "",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "description": "",
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "campaign_unavailable: Campaign details or current wider-hours evidence could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "campaign_unavailable"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "campaign_unavailable": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "campaign_unavailable",
                        "message": "Campaign details could not be checked. Please retry.",
                        "doc_url": "https://docs.nixflex.com/errors/campaign_unavailable",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/calls/batch/{id}": {
      "delete": {
        "tags": [
          "Voice campaigns"
        ],
        "summary": "Delete a voice campaign",
        "operationId": "deleteVoiceCampaign",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Cancel waiting campaign work, hang up its running calls, then remove the campaign and recipient list. Calls already made and SMS already sent remain in history. Owner and Admin may delete; Member may not. Used charges and required financial evidence remain; no refund is made. A hangup_pending response queues durable completion without waiting for settlement. Repeating the same DELETE safely resumes the same request. A lost response is not confirmed success. Customer-managed copies are outside this operation. Bulk call deletion and account closure have separate contracts.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Owned campaign identifier. Missing and foreign IDs have the same 404.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Campaign and recipient list removed. Sent history and used charges remain.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "campaign_id",
                    "deleted",
                    "message"
                  ],
                  "properties": {
                    "campaign_id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "const": true
                    },
                    "message": {
                      "type": "string",
                      "const": "Campaign deleted"
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "campaign_id": "campaign_example",
                      "deleted": true,
                      "message": "Campaign deleted"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_delete: The identifier must contain 1–200 characters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "invalid_delete"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "invalid_delete": {
                    "value": {
                      "error": {
                        "type": "invalid_request",
                        "code": "invalid_delete",
                        "message": "Choose a valid call or campaign.",
                        "doc_url": "https://docs.nixflex.com/errors/invalid_delete",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "permission_denied: Owner or Admin authority is required. A Member cannot delete content.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "permission_denied"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "permission_denied": {
                    "value": {
                      "error": {
                        "type": "permission_denied",
                        "code": "permission_denied",
                        "message": "Only an Admin or the Owner can do this.",
                        "doc_url": "https://docs.nixflex.com/errors/permission_denied",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found: The item is missing or belongs to another account. These cases have the same response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "not_found"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "not_found": {
                    "value": {
                      "error": {
                        "type": "not_found",
                        "code": "not_found",
                        "message": "Campaign not found.",
                        "doc_url": "https://docs.nixflex.com/errors/not_found",
                        "details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "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"
                        },
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "hangup_pending: Hang-up is unconfirmed and durable deletion will continue. deletion_unavailable: The result could not be confirmed; check the list and repeat the same DELETE to resume any existing request safely.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "type",
                        "code",
                        "message",
                        "doc_url",
                        "details"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "hangup_pending",
                            "deletion_unavailable"
                          ]
                        },
                        "message": {
                          "type": "string"
                        },
                        "doc_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "examples": {
                  "hangup_pending": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "hangup_pending",
                        "message": "Waiting work is cancelled. Some calls have not confirmed they ended yet. Deletion is queued and will finish once hang-up is confirmed.",
                        "doc_url": "https://docs.nixflex.com/errors/hangup_pending",
                        "details": {
                          "deleted": false,
                          "retry_pending": true
                        }
                      }
                    }
                  },
                  "deletion_unavailable": {
                    "value": {
                      "error": {
                        "type": "server_error",
                        "code": "deletion_unavailable",
                        "message": "Deletion could not be confirmed. Check the list and try Delete again; an existing request will safely resume.",
                        "doc_url": "https://docs.nixflex.com/errors/deletion_unavailable",
                        "details": {
                          "deleted": false
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "KEY_ID:KEY_SECRET from the owning account. Keep it server-side. A verified personal dashboard Bearer session may be used where the operation documents role-based access."
      }
    }
  },
  "webhooks": {
    "call.bookings": {
      "post": {
        "summary": "Receive confirmed post-call booking results",
        "description": "One logical event per ended call and configured destination when a calendar mutation succeeded. Verify the raw-body signature before parsing. Deduplicate (trusted account, event, call_id) per receiver; deliveries can repeat, be delayed or fail.",
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "X-Nixflex-Signature",
            "required": true,
            "description": "HMAC-SHA256 over timestamp.raw_body using the privately provisioned signing secret. Missing signing material retries; call.bookings is never sent unsigned.",
            "schema": {
              "type": "string",
              "pattern": "^t=[0-9]+,v1=[a-f0-9]{64}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "event",
                  "call_id",
                  "agent_id",
                  "from",
                  "to",
                  "number",
                  "ended_at",
                  "timeline",
                  "final"
                ],
                "properties": {
                  "event": {
                    "type": "string",
                    "const": "call.bookings"
                  },
                  "call_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "agent_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "from": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "to": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ended_at": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Engine call-end time in UTC; not webhook delivery time."
                  },
                  "timeline": {
                    "type": "array",
                    "minItems": 1,
                    "description": "Ordered confirmed calendar mutations during this call.",
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "action",
                        "booking_uid",
                        "start",
                        "end",
                        "attendee_name",
                        "attendee_email",
                        "service",
                        "timezone",
                        "at"
                      ],
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "created",
                            "rescheduled",
                            "cancelled"
                          ]
                        },
                        "booking_uid": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "start": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "end": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "attendee_name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "attendee_email": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "service": {
                          "type": [
                            "string",
                            "number",
                            "null"
                          ]
                        },
                        "timezone": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Engine receipt time of the successful mutation, in UTC."
                        }
                      }
                    }
                  },
                  "final": {
                    "type": "array",
                    "minItems": 1,
                    "description": "One result per resulting booking UID. This is not a full calendar inventory.",
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "status",
                        "booking_uid",
                        "start",
                        "end",
                        "attendee_name",
                        "attendee_email",
                        "service",
                        "timezone"
                      ],
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "cancelled"
                          ]
                        },
                        "booking_uid": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "start": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "end": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "attendee_name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "attendee_email": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "service": {
                          "type": [
                            "string",
                            "number",
                            "null"
                          ]
                        },
                        "timezone": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                }
              },
              "examples": {
                "create_move": {
                  "summary": "Create then move: one active booking at the moved time.",
                  "value": {
                    "event": "call.bookings",
                    "call_id": "call_example",
                    "agent_id": "agent_example",
                    "from": "+12025550101",
                    "to": "+12025550100",
                    "number": "+12025550100",
                    "ended_at": "2030-11-04T09:05:00.000Z",
                    "timeline": [
                      {
                        "action": "created",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T10:00:00.000Z",
                        "end": "2030-11-04T10:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:01:00.000Z"
                      },
                      {
                        "action": "rescheduled",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:02:00.000Z"
                      }
                    ],
                    "final": [
                      {
                        "status": "active",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London"
                      }
                    ]
                  }
                },
                "create_cancel": {
                  "summary": "Create then cancel: one cancelled result, zero active.",
                  "value": {
                    "event": "call.bookings",
                    "call_id": "call_example",
                    "agent_id": "agent_example",
                    "from": "+12025550101",
                    "to": "+12025550100",
                    "number": "+12025550100",
                    "ended_at": "2030-11-04T09:05:00.000Z",
                    "timeline": [
                      {
                        "action": "created",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T10:00:00.000Z",
                        "end": "2030-11-04T10:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:01:00.000Z"
                      },
                      {
                        "action": "cancelled",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T10:00:00.000Z",
                        "end": "2030-11-04T10:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:02:00.000Z"
                      }
                    ],
                    "final": [
                      {
                        "status": "cancelled",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T10:00:00.000Z",
                        "end": "2030-11-04T10:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London"
                      }
                    ]
                  }
                },
                "create_move_cancel": {
                  "summary": "Create, move, cancel: cancelled at the last known time.",
                  "value": {
                    "event": "call.bookings",
                    "call_id": "call_example",
                    "agent_id": "agent_example",
                    "from": "+12025550101",
                    "to": "+12025550100",
                    "number": "+12025550100",
                    "ended_at": "2030-11-04T09:05:00.000Z",
                    "timeline": [
                      {
                        "action": "created",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T10:00:00.000Z",
                        "end": "2030-11-04T10:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:01:00.000Z"
                      },
                      {
                        "action": "rescheduled",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:02:00.000Z"
                      },
                      {
                        "action": "cancelled",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:03:00.000Z"
                      }
                    ],
                    "final": [
                      {
                        "status": "cancelled",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London"
                      }
                    ]
                  }
                },
                "move_existing": {
                  "summary": "Move an existing booking: one active result at its new time.",
                  "value": {
                    "event": "call.bookings",
                    "call_id": "call_example",
                    "agent_id": "agent_example",
                    "from": "+12025550101",
                    "to": "+12025550100",
                    "number": "+12025550100",
                    "ended_at": "2030-11-04T09:05:00.000Z",
                    "timeline": [
                      {
                        "action": "rescheduled",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:01:00.000Z"
                      }
                    ],
                    "final": [
                      {
                        "status": "active",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London"
                      }
                    ]
                  }
                },
                "two_bookings": {
                  "summary": "Two independent booking UIDs: two active results.",
                  "value": {
                    "event": "call.bookings",
                    "call_id": "call_example",
                    "agent_id": "agent_example",
                    "from": "+12025550101",
                    "to": "+12025550100",
                    "number": "+12025550100",
                    "ended_at": "2030-11-04T09:05:00.000Z",
                    "timeline": [
                      {
                        "action": "created",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T10:00:00.000Z",
                        "end": "2030-11-04T10:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:01:00.000Z"
                      },
                      {
                        "action": "created",
                        "booking_uid": "booking_second",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:02:00.000Z"
                      }
                    ],
                    "final": [
                      {
                        "status": "active",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T10:00:00.000Z",
                        "end": "2030-11-04T10:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London"
                      },
                      {
                        "status": "active",
                        "booking_uid": "booking_second",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London"
                      }
                    ]
                  }
                },
                "replacement_uid": {
                  "summary": "A replacement UID is resolved in final; timeline retains original action IDs.",
                  "value": {
                    "event": "call.bookings",
                    "call_id": "call_example",
                    "agent_id": "agent_example",
                    "from": "+12025550101",
                    "to": "+12025550100",
                    "number": "+12025550100",
                    "ended_at": "2030-11-04T09:05:00.000Z",
                    "timeline": [
                      {
                        "action": "created",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T10:00:00.000Z",
                        "end": "2030-11-04T10:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:01:00.000Z"
                      },
                      {
                        "action": "rescheduled",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London",
                        "at": "2030-11-04T09:02:00.000Z"
                      }
                    ],
                    "final": [
                      {
                        "status": "active",
                        "booking_uid": "booking_replacement",
                        "start": "2030-11-04T11:00:00.000Z",
                        "end": "2030-11-04T11:30:00.000Z",
                        "attendee_name": "Sam Carter",
                        "attendee_email": "sam@example.test",
                        "service": "Consultation",
                        "timezone": "Europe/London"
                      }
                    ]
                  }
                },
                "unknown_fields": {
                  "summary": "Preserve nullable unknown fields and numeric legacy service.",
                  "value": {
                    "event": "call.bookings",
                    "call_id": "call_example",
                    "agent_id": "agent_example",
                    "from": "+12025550101",
                    "to": "+12025550100",
                    "number": "+12025550100",
                    "ended_at": "2030-11-04T09:05:00.000Z",
                    "timeline": [
                      {
                        "action": "rescheduled",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T10:00:00.000Z",
                        "end": null,
                        "attendee_name": null,
                        "attendee_email": null,
                        "service": 42,
                        "timezone": null,
                        "at": "2030-11-04T09:01:00.000Z"
                      }
                    ],
                    "final": [
                      {
                        "status": "active",
                        "booking_uid": "booking_example",
                        "start": "2030-11-04T10:00:00.000Z",
                        "end": null,
                        "attendee_name": null,
                        "attendee_email": null,
                        "service": 42,
                        "timezone": null
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receiver has durably stored the verified event, or already has this logical event. Return 2xx directly; do not redirect."
          }
        }
      }
    }
  }
}
