{
  "openapi": "3.0.3",
  "info": {
    "title": "Voice AI internal service",
    "version": "1.0.0",
    "description": "Private backend API. Dedicated non-admin identities are bound to a fixed tenant and allowed agents. Scoped identities may read only approved agent handoffs and their own live-session lifecycle, media, transcript and usage. Handoffs expose no credentials, instructions or storage paths; agent listing/CRUD remains operator-only. Health provider describes the global default; handoff provider describes the selected agent. See docs/realtime-protocol.md for unchanged authenticated media schemas."
  },
  "servers": [
    {
      "url": "https://192.168.1.69:9445",
      "description": "Private LAN UAT; trust dedicated CA"
    },
    {
      "url": "http://127.0.0.1:8082"
    }
  ],
  "security": [
    {
      "InternalService": []
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Public liveness",
        "operationId": "get__health",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/assistant-capabilities": {
      "get": {
        "summary": "Operator-approved Assistant catalogue; gated publication; no tools/indexing",
        "operationId": "get__v1_assistant_capabilities",
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantCapabilities"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/assistant-profile-publications": {
      "post": {
        "summary": "Prepare an immutable per-number profile with durable replay protection",
        "operationId": "post__v1_assistant_profile_publications",
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:-]{1,100}$"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantPublicationOperation"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssistantPublicationInput"
              }
            }
          }
        }
      }
    },
    "/v1/assistant-profile-publications/{operationId}": {
      "get": {
        "summary": "Reconcile publication by the same durable operation identity",
        "operationId": "get__v1_assistant_profile_publications__operationId_",
        "parameters": [
          {
            "name": "operationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantPublicationOperation"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tenants/{id}": {
      "put": {
        "summary": "Replace tenant policy and business knowledge",
        "operationId": "put__v1_tenants__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-admin-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Separate operator-only key"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Tenant"
              }
            }
          }
        }
      },
      "get": {
        "summary": "Read tenant policy",
        "operationId": "get__v1_tenants__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-admin-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Separate operator-only key"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tenant"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tenants/{id}/retained-data": {
      "delete": {
        "summary": "Purge expired transcript and analysis content",
        "operationId": "delete__v1_tenants__id__retained_data",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-admin-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Separate operator-only key"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents": {
      "post": {
        "summary": "Create versioned tenant agent",
        "operationId": "post__v1_agents",
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Agent"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentInput"
              }
            }
          }
        }
      },
      "get": {
        "summary": "List tenant agents",
        "operationId": "get__v1_agents",
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Agent"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{id}": {
      "get": {
        "summary": "Read tenant agent",
        "operationId": "get__v1_agents__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Agent"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Replace agent and increment prompt version",
        "operationId": "put__v1_agents__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Agent"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentInput"
              }
            }
          }
        }
      }
    },
    "/v1/agent-handoffs/{id}": {
      "get": {
        "summary": "Read non-secret runtime metadata for an identity-approved agent only",
        "operationId": "get__v1_agent_handoffs__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentHandoff"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/live-sessions": {
      "post": {
        "summary": "Create voice or transcription-only session",
        "operationId": "post__v1_live_sessions",
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionInput"
              }
            }
          }
        }
      }
    },
    "/v1/live-sessions/{id}": {
      "get": {
        "summary": "Inspect live session",
        "operationId": "get__v1_live_sessions__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "End live session",
        "operationId": "delete__v1_live_sessions__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/live-sessions/{id}/audio": {
      "get": {
        "summary": "Authenticated WebSocket upgrade; see /docs/realtime-protocol.md and /docs/realtime-events.json",
        "operationId": "get__v1_live_sessions__id__audio",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "101": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "WSS JSON text media. Authorization bearer and x-tenant-id required in upgrade headers. One attachment to an owned ready session; no query credentials or reconnect. Audio PCM16LE mono24kHz. This operation is an upgrade, not an HTTP JSON response."
      }
    },
    "/v1/transcriptions": {
      "post": {
        "summary": "Upload recording or submit tenant-local storage reference",
        "operationId": "post__v1_transcriptions",
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcription"
                }
              }
            }
          },
          "202": {
            "description": "Asynchronous transcription accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcription"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TranscriptionInput"
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "callId",
                  "file"
                ],
                "properties": {
                  "callId": {
                    "type": "string"
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "async": {
                    "type": "boolean"
                  },
                  "diarize": {
                    "type": "boolean"
                  },
                  "analyse": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/transcriptions/{id}": {
      "get": {
        "summary": "Get transcription status and result",
        "operationId": "get__v1_transcriptions__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcription"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/calls/{callId}/transcript": {
      "get": {
        "summary": "Read retained call transcript",
        "operationId": "get__v1_calls__callId__transcript",
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete call transcript, transcription results and analysis",
        "operationId": "delete__v1_calls__callId__transcript",
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/calls/{callId}/analyse": {
      "post": {
        "summary": "Summarize, extract and classify retained call transcript",
        "operationId": "post__v1_calls__callId__analyse",
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Analysis"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/calls/{callId}/analysis": {
      "get": {
        "summary": "Get retained structured call analysis",
        "operationId": "get__v1_calls__callId__analysis",
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Analysis"
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/calls/{callId}/actions": {
      "get": {
        "summary": "Poll validated telephony action requests",
        "operationId": "get__v1_calls__callId__actions",
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "summary": "List tenant usage quantities",
        "operationId": "get__v1_usage",
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Usage"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/audit": {
      "get": {
        "summary": "List tenant audit metadata",
        "operationId": "get__v1_audit",
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For scoped identities this is an assertion of the fixed credential tenant; selecting another tenant is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "default": {
            "description": "Normalized error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "InternalService": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "requestId": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "requestId"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Tenant": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "entitlements": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "recordingEnabled": {
            "type": "boolean"
          },
          "transcriptionEnabled": {
            "type": "boolean"
          },
          "aiAnsweringEnabled": {
            "type": "boolean"
          },
          "aiDisclosureMessage": {
            "type": "string"
          },
          "recordingDisclosureMessage": {
            "type": "string"
          },
          "maxCallDurationSeconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          },
          "maxConcurrentAiCalls": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "dailyAiMinutes": {
            "type": "number"
          },
          "monthlyAiMinutes": {
            "type": "number"
          },
          "retentionDays": {
            "type": "integer",
            "minimum": 0,
            "maximum": 365
          },
          "allowedCalendars": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowedTransferTargets": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowedEmailRecipients": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "hints": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "knowledge": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "entitlements",
          "recordingEnabled",
          "transcriptionEnabled",
          "aiAnsweringEnabled",
          "aiDisclosureMessage",
          "recordingDisclosureMessage",
          "maxCallDurationSeconds",
          "maxConcurrentAiCalls",
          "dailyAiMinutes",
          "monthlyAiMinutes",
          "retentionDays",
          "allowedCalendars",
          "allowedTransferTargets",
          "allowedEmailRecipients",
          "hints",
          "knowledge"
        ]
      },
      "AgentInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "voice": {
            "type": "string"
          },
          "instructions": {
            "type": "string"
          },
          "greeting": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "businessHours": {
            "type": "object",
            "additionalProperties": true
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "runtime": {
            "type": "object",
            "properties": {
              "provider": {
                "enum": [
                  "mock",
                  "openai"
                ]
              },
              "model": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "credentialRef": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,100}$"
              },
              "knowledgeRef": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-][A-Za-z0-9_.-]{0,99}\\.md$"
              },
              "toolPolicy": {
                "enum": [
                  "disabled",
                  "agent"
                ]
              },
              "sessionPolicy": {
                "type": "object",
                "properties": {
                  "mode": {
                    "enum": [
                      "voice"
                    ]
                  },
                  "textInputMaxTurns": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 20
                  },
                  "maxDurationSeconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3600
                  },
                  "maxSessionSeconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3600
                  },
                  "greetingPolicy": {
                    "enum": [
                      "profile",
                      "tenant-disclosure"
                    ]
                  },
                  "includeTenantKnowledge": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "mode",
                  "textInputMaxTurns",
                  "maxDurationSeconds",
                  "greetingPolicy",
                  "includeTenantKnowledge"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "provider",
              "model",
              "toolPolicy",
              "sessionPolicy"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "enabled",
          "voice",
          "instructions",
          "greeting",
          "language",
          "businessHours",
          "tools"
        ]
      },
      "Agent": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "voice": {
            "type": "string"
          },
          "instructions": {
            "type": "string"
          },
          "greeting": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "businessHours": {
            "type": "object",
            "additionalProperties": true
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "runtime": {
            "type": "object",
            "properties": {
              "provider": {
                "enum": [
                  "mock",
                  "openai"
                ]
              },
              "model": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "credentialRef": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,100}$"
              },
              "knowledgeRef": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-][A-Za-z0-9_.-]{0,99}\\.md$"
              },
              "toolPolicy": {
                "enum": [
                  "disabled",
                  "agent"
                ]
              },
              "sessionPolicy": {
                "type": "object",
                "properties": {
                  "mode": {
                    "enum": [
                      "voice"
                    ]
                  },
                  "textInputMaxTurns": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 20
                  },
                  "maxDurationSeconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3600
                  },
                  "maxSessionSeconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3600
                  },
                  "greetingPolicy": {
                    "enum": [
                      "profile",
                      "tenant-disclosure"
                    ]
                  },
                  "includeTenantKnowledge": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "mode",
                  "textInputMaxTurns",
                  "maxDurationSeconds",
                  "greetingPolicy",
                  "includeTenantKnowledge"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "provider",
              "model",
              "toolPolicy",
              "sessionPolicy"
            ],
            "additionalProperties": false
          },
          "id": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          },
          "assistant": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "name",
          "enabled",
          "voice",
          "instructions",
          "greeting",
          "language",
          "businessHours",
          "tools",
          "id",
          "tenantId",
          "version"
        ]
      },
      "AgentHandoff": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "agentId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "profileVersion": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "mock",
              "openai"
            ]
          },
          "model": {
            "type": "string"
          },
          "voice": {
            "type": "string"
          },
          "greeting": {
            "type": "string"
          },
          "toolsEnabled": {
            "type": "boolean"
          },
          "maxSessionSeconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          },
          "knowledge": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "attached": {
                "type": "boolean"
              },
              "sha256": {
                "type": "string",
                "nullable": true
              }
            },
            "required": [
              "attached",
              "sha256"
            ]
          },
          "realtime": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "protocol": {
                "type": "string",
                "enum": [
                  "voiceai-json-v1"
                ]
              },
              "mode": {
                "type": "string",
                "enum": [
                  "voice"
                ]
              },
              "maxDurationSeconds": {
                "type": "integer"
              },
              "textInputMaxTurns": {
                "type": "integer"
              },
              "audioFormat": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "encoding": {
                    "type": "string"
                  },
                  "channels": {
                    "type": "integer"
                  },
                  "sampleRate": {
                    "type": "integer"
                  }
                },
                "required": [
                  "encoding",
                  "channels",
                  "sampleRate"
                ]
              }
            },
            "required": [
              "protocol",
              "mode",
              "maxDurationSeconds",
              "textInputMaxTurns",
              "audioFormat"
            ]
          },
          "numberId": {
            "type": "string"
          },
          "configurationRevision": {
            "type": "integer"
          },
          "contentHash": {
            "type": "string"
          },
          "knowledgeManifestId": {
            "type": "string"
          },
          "knowledgeManifestHash": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "voiceId": {
            "type": "string"
          }
        },
        "required": [
          "agentId",
          "tenantId",
          "profileVersion",
          "name",
          "provider",
          "model",
          "voice",
          "greeting",
          "toolsEnabled",
          "maxSessionSeconds",
          "knowledge",
          "realtime"
        ]
      },
      "SessionInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "tenantId": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "callId": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "caller": {
            "type": "string"
          },
          "called": {
            "type": "string"
          },
          "direction": {
            "enum": [
              "inbound",
              "outbound"
            ],
            "type": "string"
          },
          "mode": {
            "enum": [
              "voice",
              "transcription"
            ],
            "type": "string"
          },
          "metering_context": {
            "type": "object",
            "properties": {
              "contractVersion": {
                "type": "string",
                "enum": [
                  "relay-ai-metering-v1"
                ]
              },
              "operationId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.:-]{1,100}$"
              },
              "tenantId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.:-]{1,100}$"
              },
              "resource": {
                "type": "object",
                "properties": {
                  "type": {
                    "enum": [
                      "recording",
                      "call",
                      "greeting",
                      "voicemail",
                      "other"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_.:-]{1,100}$"
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "groupId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.:-]{1,100}$"
              },
              "componentId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.:-]{1,100}$"
              },
              "reservationId": {
                "type": "string",
                "nullable": true,
                "pattern": "^[A-Za-z0-9_.:-]{1,100}$"
              }
            },
            "required": [
              "contractVersion",
              "operationId",
              "tenantId",
              "resource",
              "groupId",
              "componentId",
              "reservationId"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "tenantId",
          "agentId",
          "callId",
          "caller",
          "called",
          "direction"
        ]
      },
      "Session": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "callId": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "audioFormat": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "encoding": {
                "type": "string"
              },
              "channels": {
                "type": "integer"
              },
              "sampleRate": {
                "type": "integer"
              }
            },
            "required": [
              "encoding",
              "channels",
              "sampleRate"
            ]
          },
          "websocketPath": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenantId",
          "callId",
          "agentId",
          "mode",
          "status",
          "audioFormat",
          "websocketPath"
        ]
      },
      "TranscriptionInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "callId": {
            "type": "string"
          },
          "recordingRef": {
            "type": "string"
          },
          "async": {
            "type": "boolean"
          },
          "diarize": {
            "type": "boolean"
          },
          "analyse": {
            "type": "boolean"
          }
        },
        "required": [
          "callId",
          "recordingRef"
        ]
      },
      "Transcription": {
        "type": "object",
        "required": [
          "transcriptionId",
          "status"
        ],
        "properties": {
          "transcriptionId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "completed",
              "failed"
            ]
          },
          "text": {
            "type": "string"
          },
          "language": {
            "type": "string",
            "nullable": true
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "error": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Analysis": {
        "type": "object",
        "required": [
          "summary",
          "outcome",
          "callbackRequired",
          "priority",
          "actions",
          "sentiment",
          "topics",
          "classification"
        ],
        "properties": {
          "summary": {
            "type": "string"
          },
          "outcome": {
            "type": "string"
          },
          "callerName": {
            "type": "string",
            "nullable": true
          },
          "company": {
            "type": "string",
            "nullable": true
          },
          "reasonForCall": {
            "type": "string"
          },
          "callbackRequired": {
            "type": "boolean"
          },
          "callbackNumber": {
            "type": "string",
            "nullable": true
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "high"
            ]
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sentiment": {
            "type": "string",
            "enum": [
              "positive",
              "neutral",
              "negative"
            ]
          },
          "topics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "classification": {
            "type": "string"
          },
          "message": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "Usage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "callId": {
            "type": "string",
            "nullable": true
          },
          "agentId": {
            "type": "string",
            "nullable": true
          },
          "operation": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "quantities": {
            "type": "object",
            "additionalProperties": true
          },
          "at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "tenantId",
          "operation",
          "model",
          "quantities",
          "at"
        ]
      },
      "AssistantPublicationInput": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string",
            "format": "uuid"
          },
          "numberId": {
            "type": "string",
            "format": "uuid"
          },
          "configurationRevision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "expectedPreviousProfileVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "nullable": true
          },
          "contentHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "profile": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "enum": [
                  1
                ],
                "type": "integer"
              },
              "enabled": {
                "type": "boolean"
              },
              "answeringMode": {
                "enum": [
                  "ALWAYS",
                  "IN_BUSINESS_HOURS",
                  "OUTSIDE_BUSINESS_HOURS",
                  "NO_ANSWER",
                  "DISABLED"
                ]
              },
              "businessIdentity": {
                "type": "object",
                "properties": {
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^[^<>\\u0000-\\u001f\\u007f]+$"
                  },
                  "description": {
                    "type": "string",
                    "minLength": 0,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "displayName",
                  "description"
                ],
                "additionalProperties": false
              },
              "instructions": {
                "type": "string",
                "minLength": 0,
                "maxLength": 16000
              },
              "greeting": {
                "type": "object",
                "properties": {
                  "kind": {
                    "enum": [
                      "TEXT"
                    ],
                    "type": "string"
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "kind",
                  "text"
                ],
                "additionalProperties": false
              },
              "speech": {
                "type": "object",
                "properties": {
                  "voiceId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "nullable": true
                  },
                  "languageTag": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "nullable": true
                  }
                },
                "required": [
                  "voiceId",
                  "languageTag"
                ],
                "additionalProperties": false
              },
              "knowledge": {
                "type": "object",
                "properties": {
                  "documents": {
                    "type": "array",
                    "maxItems": 50,
                    "uniqueItems": true,
                    "items": {
                      "type": "object",
                      "properties": {
                        "documentId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "documentVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9007199254740991
                        },
                        "indexVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "documentId",
                        "documentVersion",
                        "indexVersion"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "documents"
                ],
                "additionalProperties": false
              },
              "escalation": {
                "type": "object",
                "properties": {
                  "transferTargetIds": {
                    "type": "array",
                    "maxItems": 10,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "onUnavailable": {
                    "enum": [
                      "END_GRACEFULLY"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "transferTargetIds",
                  "onUnavailable"
                ],
                "additionalProperties": false
              },
              "actions": {
                "type": "object",
                "properties": {
                  "allowedActionIds": {
                    "type": "array",
                    "maxItems": 20,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    }
                  }
                },
                "required": [
                  "allowedActionIds"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "schemaVersion",
              "enabled",
              "answeringMode",
              "businessIdentity",
              "instructions",
              "greeting",
              "speech",
              "knowledge",
              "escalation",
              "actions"
            ],
            "additionalProperties": false
          },
          "knowledgeManifest": {
            "type": "object",
            "properties": {
              "manifestId": {
                "type": "string",
                "format": "uuid"
              },
              "contentHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "entries": {
                "type": "array",
                "maxItems": 50,
                "uniqueItems": true,
                "items": {
                  "type": "object",
                  "properties": {
                    "documentId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "documentVersion": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "indexVersion": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "indexId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "sha256": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    }
                  },
                  "required": [
                    "documentId",
                    "documentVersion",
                    "indexVersion",
                    "indexId",
                    "sha256"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "manifestId",
              "contentHash",
              "entries"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "operationId",
          "numberId",
          "configurationRevision",
          "expectedPreviousProfileVersion",
          "contentHash",
          "profile",
          "knowledgeManifest"
        ],
        "additionalProperties": false
      },
      "AssistantPublicationOperation": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "enum": [
              "PREPARING",
              "READY",
              "FAILED"
            ]
          },
          "profileId": {
            "type": "string",
            "nullable": true
          },
          "profileVersion": {
            "type": "string",
            "nullable": true
          },
          "verifiedHash": {
            "type": "string",
            "nullable": true
          },
          "errorCode": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "operationId",
          "state",
          "profileId",
          "profileVersion",
          "verifiedHash",
          "errorCode"
        ],
        "additionalProperties": false
      },
      "AssistantCapabilities": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "catalogueRevision": {
            "type": "string"
          },
          "voices": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string"
                },
                "available": {
                  "type": "boolean"
                },
                "reason": {
                  "type": "string",
                  "nullable": true
                },
                "realtimeAvailable": {
                  "type": "boolean"
                },
                "greetingTtsAvailable": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "available",
                "reason",
                "realtimeAvailable",
                "greetingTtsAvailable"
              ]
            }
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string"
                },
                "available": {
                  "type": "boolean"
                },
                "reason": {
                  "type": "string",
                  "nullable": true
                }
              },
              "required": [
                "id",
                "available",
                "reason"
              ]
            }
          },
          "limits": {
            "type": "object",
            "additionalProperties": true
          },
          "immutablePublicationAvailable": {
            "type": "boolean"
          },
          "knowledgeIndexAvailable": {
            "type": "boolean"
          },
          "toolsEnabled": {
            "type": "boolean",
            "enum": [
              false
            ]
          }
        },
        "required": [
          "schemaVersion",
          "catalogueRevision",
          "voices",
          "languages",
          "limits",
          "immutablePublicationAvailable",
          "knowledgeIndexAvailable",
          "toolsEnabled"
        ]
      }
    }
  }
}
