{
  "openapi": "3.0.4",
  "info": {
    "title": "CloseBot API",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.closebot.com",
      "description": "CloseBot API Endpoint"
    }
  ],
  "paths": {
    "/account/apiKey": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Create API Key",
        "description": "Creates a new API key.",
        "requestBody": {
          "description": "Key name",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyOutput"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyOutput"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyOutput"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List API keys",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKeyDTO"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKeyDTO"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKeyDTO"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/account/apiKey/{keyId}": {
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Delete API Key",
        "description": "Deletes an API key.",
        "parameters": [
          {
            "name": "keyId",
            "in": "path",
            "description": "The key ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/account-notifications": {
      "get": {
        "tags": [
          "AccountNotification"
        ],
        "summary": "List the calling account's notifications for the active agency.",
        "responses": {
          "default": {
            "description": "Error",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AccountNotificationDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AccountNotificationDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AccountNotificationDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/account-notifications/{id}": {
      "put": {
        "tags": [
          "AccountNotification"
        ],
        "summary": "Update one of the calling account's notifications.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountNotificationUpdateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountNotificationUpdateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AccountNotificationUpdateDto"
              }
            }
          }
        },
        "responses": {
          "default": {
            "description": "Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AccountNotificationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountNotificationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountNotificationDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/email-domain": {
      "get": {
        "tags": [
          "Agency"
        ],
        "summary": "Get the agency's sending domain and the DNS records needed to verify it.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/EmailDomainDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailDomainDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailDomainDto"
                }
              }
            }
          },
          "204": {
            "description": "No Content"
          }
        }
      },
      "post": {
        "tags": [
          "Agency"
        ],
        "summary": "Register a sending domain for this agency and return the DNS records to add.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEmailDomainDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEmailDomainDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEmailDomainDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/EmailDomainDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailDomainDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailDomainDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Agency"
        ],
        "summary": "Remove this agency's sending domain. Mail reverts to CloseBot branding.",
        "responses": {
          "204": {
            "description": "No Content"
          }
        }
      }
    },
    "/agency/email-domain/verify": {
      "post": {
        "tags": [
          "Agency"
        ],
        "summary": "Ask Resend to re-check this agency's DNS records.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/EmailDomainDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailDomainDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailDomainDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/agency/current": {
      "get": {
        "tags": [
          "Agency"
        ],
        "summary": "Get agency",
        "description": "Retrieve the current agency details.\n            \nCurrently, CloseBot accounts can only be part of one agency.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AgencyDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencyDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencyDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/usage": {
      "get": {
        "tags": [
          "Agency"
        ],
        "summary": "Get usage",
        "parameters": [
          {
            "name": "scopes",
            "in": "query",
            "description": "Comma-separated list of scopes to retrieve. Scopes are: bots, storage, users, responses.",
            "schema": {
              "type": "string",
              "default": "bots,storage,users,responses"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/agency/invite": {
      "post": {
        "tags": [
          "Agency"
        ],
        "summary": "Invite users",
        "requestBody": {
          "description": "Emails to invite",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteUserInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteUserInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/InviteUserInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Agency"
        ],
        "summary": "Revoke invitation",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "description": "The invited email to revoke",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/agency": {
      "get": {
        "tags": [
          "Agency"
        ],
        "summary": "List agencies",
        "description": "List all agencies the account is a part of.\n\nCurrently, CloseBot accounts can only be part of one agency.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgencyDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgencyDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgencyDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/analytics/dimensions/{dimension}/values": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "List dimension values available for a given dimension.",
        "parameters": [
          {
            "name": "dimension",
            "in": "path",
            "description": "One of channel, bot, persona, detail1, detail2.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "metric",
            "in": "query",
            "description": "Required for detail1/detail2 — their meaning depends on the metric.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AnalyticsDimensionValueDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AnalyticsDimensionValueDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AnalyticsDimensionValueDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/analytics/metrics": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "List all metrics available.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AnalyticsMetricDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AnalyticsMetricDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AnalyticsMetricDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/analytics/query": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "summary": "Run an analytics query for the active agency.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnalyticsQueryRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AnalyticsQueryRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AnalyticsQueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsQueryResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsQueryResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsQueryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/analytics/source-timezones": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Time zones configured on the agency's sources, used to pick a sensible default for\ntime-of-day analytics (see the hourOfWeek resolution on POST /analytics/query).",
        "parameters": [
          {
            "name": "sourceIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsSourceTimeZonesResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsSourceTimeZonesResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsSourceTimeZonesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/analytics/topics/options": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "summary": "Topics available as a conversations filter, optionally scoped to a set of sources.",
        "description": "One rule covers both cases: a topic is listed when it has at least one LeadTopic row in\nscope. That deliberately carries no Status predicate. Only Active slugs ever enter the\nclassifier enum (TopicClassificationPrompt) and the collector refuses to write a fact row\nfor a non-Active topic, so Proposed topics provably have zero rows and fall out on their\nown — while Merged and Archived topics stay filterable for as long as their history does.\nFiltering on Status instead would offer topics that always return zero conversations.\n            \nUnpaginated by design: the taxonomy is capped at 30 Active topics per agency, so this is\na ListPersonas-shaped endpoint, not a GetSources-shaped one.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TopicOptionsRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TopicOptionsRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TopicOptionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TopicOptionsResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicOptionsResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicOptionsResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/analytics/topics": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "summary": "Topic treemap and per-topic daily series for the active agency.",
        "description": "A dedicated endpoint rather than another metric on /analytics/query, for three reasons:\nAnalyticsQueryPoint.Value is an int and average sentiment is a nullable double; the treemap\nand its sparklines must come from one snapshot or a batch landing mid-request can make the\nrectangles disagree with the trend lines; and Query's validator hard-requires 15-minute\nalignment while topics are day-grained.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TopicsQueryRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TopicsQueryRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TopicsQueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TopicsQueryResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicsQueryResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicsQueryResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/assistant/session/{sessionId}/fork": {
      "post": {
        "tags": [
          "Assistant"
        ],
        "summary": "Branch a session at a message, so a different line of questioning can be explored without\nlosing the one already there.\n            \nCopies the transcript up to the chosen message, plus the scope pills and any charts those\nreplies drew. Tool calls are deliberately not copied: they are a record of things that\nactually happened, once, in the original session, and duplicating the rows would read as the\nassistant having done it all twice. The replies describing those actions still carry across,\nwhich is exactly what the model itself sees — it builds its prompt from messages, not from\nthe action trail. Charts go the other way for the same reason stated differently: they are\nnot a record of an action, they are part of what a copied reply says.",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForkSessionInputDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ForkSessionInputDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ForkSessionInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantSessionDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantSessionDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantSessionDto"
                }
              }
            }
          }
        }
      }
    },
    "/assistant/session/{sessionId}/context/{contextId}": {
      "delete": {
        "tags": [
          "Assistant"
        ],
        "summary": "Remove a context pill, loosening scope. Removing the last one makes the session global.",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contextId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/assistant/pills/search": {
      "get": {
        "tags": [
          "Assistant"
        ],
        "summary": "Typeahead for the \"+ Add context\" affordance, across all three pill kinds.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PillCandidateDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PillCandidateDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PillCandidateDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/assistant/sessions": {
      "get": {
        "tags": [
          "Assistant"
        ],
        "summary": "The caller's own session history, newest first.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AssistantSessionSummaryDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AssistantSessionSummaryDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AssistantSessionSummaryDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/assistant/session/{sessionId}": {
      "get": {
        "tags": [
          "Assistant"
        ],
        "summary": "One session with its full transcript, pills and action trail.",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantSessionDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantSessionDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantSessionDto"
                }
              }
            }
          }
        }
      }
    },
    "/assistant/session/{sessionId}/close": {
      "post": {
        "tags": [
          "Assistant"
        ],
        "summary": "Mark a session done. The next question starts a fresh one.",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/assistant/tool-call/{toolCallId}/reject": {
      "post": {
        "tags": [
          "Assistant"
        ],
        "summary": "Reject a proposed tool call. The reason is given back to the assistant so it can try\nsomething else rather than simply stopping.",
        "parameters": [
          {
            "name": "toolCallId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RejectToolCallInputDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RejectToolCallInputDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RejectToolCallInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/agency/billing/refill": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Refill agency wallet",
        "description": "Attempts to charge the payment method on file for the agency to refill the agency wallet.\n\n<strong>\nInvoking this endpoint will charge you. Use with caution.\n</strong>",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRefillDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRefillDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRefillDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/agency/billing/refill/source/{sourceId}": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Refill source wallet",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRefillDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRefillDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRefillDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/agency/billing/re-billing": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get re-billing settings",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ReBillingDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReBillingDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReBillingDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Billing"
        ],
        "summary": "Update re-billing",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReBillingUpdateInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ReBillingUpdateInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ReBillingUpdateInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/agency/billing/ai-cost-breakdown": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "AI cost breakdown for a period",
        "description": "Splits the period's AI spend by what drove it — global prompt base, node instructions,\ntool descriptions, knowledge base, tool results, conversation history, response format,\nthinking, emitted tool calls and the reply itself.\n            \nInjected variable values are costed against the section they were injected into rather\nthan broken out separately, so the same substitution cannot appear under both the agent\nnode and the global prompt area.\n            \nThe response separates flat-rate (\"standard\") traffic from cost-based (\"metered\") traffic.\nOnly the metered block carries shares and segments; multiply the shares by the metered\nportion of the invoice to get dollars. Standard traffic is billed at a fixed per-message\nrate, so it is reported as a call count alone — its real cost composition is captured\ninternally but deliberately never emitted, because it would describe money the customer\ndid not pay.",
        "parameters": [
          {
            "name": "startTime",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "endTime",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AiCostBreakdownDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiCostBreakdownDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiCostBreakdownDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/billing/balance": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get agency balance",
        "description": "Gets the balance of the agency.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/billing/options": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get agency billing",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BillingOptionsDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingOptionsDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingOptionsDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Billing"
        ],
        "summary": "Update agency billing",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBillingConfigInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBillingConfigInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBillingConfigInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BillingOptionsDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingOptionsDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingOptionsDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/billing/balance/source/{sourceId}": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get source balance",
        "description": "Gets the balance of the source.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/billing/transactions/source/{sourceId}": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List source transactions",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter by status when included. Statuses are: pending, succeeded, failed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "Filter by transaction type when included. Comma-separated list of:\nusage, refill, gift, credit, adjustment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionDtoPaginated"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionDtoPaginated"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionDtoPaginated"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Add source transaction",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddSourceTransactionDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AddSourceTransactionDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AddSourceTransactionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/billing/transactions": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List agency transactions",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Filter by status when included. Statuses are: pending, succeeded, failed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "Filter by transaction type when included. Comma-separated list of:\nusage, refill, gift, credit, adjustment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionDtoPaginated"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionDtoPaginated"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionDtoPaginated"
                }
              }
            }
          }
        }
      }
    },
    "/agency/billing/usages": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List billed usages",
        "parameters": [
          {
            "name": "startTime",
            "in": "query",
            "description": "The start time.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "endTime",
            "in": "query",
            "description": "The end time.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BilledUsageDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BilledUsageDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BilledUsageDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agency/billing/transactions/source/{sourceId}/{id}": {
      "delete": {
        "tags": [
          "Billing"
        ],
        "summary": "Delete source transaction",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "ID of the transaction to delete.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/bot/ai": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "Create bot with AI",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AiCreateBotInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AiCreateBotInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AiCreateBotInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/source/{sourceId}": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "Attach a source to a bot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AttachSourceInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AttachSourceInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AttachSourceInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Bot"
        ],
        "summary": "Detach a source from a bot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/bot/{id}/source/{sourceId}/mcp-server": {
      "get": {
        "tags": [
          "Bot"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotSourceMcpAuthDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotSourceMcpAuthDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotSourceMcpAuthDto"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Bot"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BotSourceMcpAuthInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BotSourceMcpAuthInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BotSourceMcpAuthInput"
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Bot"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "serverUrl",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/bot": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "Create a new bot",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBotInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBotInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBotInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Bot"
        ],
        "summary": "List bots",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}": {
      "delete": {
        "tags": [
          "Bot"
        ],
        "summary": "Delete a bot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Bot"
        ],
        "summary": "Get a bot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Bot"
        ],
        "summary": "Update a bot",
        "description": "Updates fields in a bot.\n\nOnly non-null fields are updated. Any missing or null field is ignored.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBotInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBotInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBotInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateBotErrorResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateBotErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateBotErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateBotErrorResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateBotErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateBotErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/duplicate": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "Duplicate a bot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/persona-split-test/end": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "End a persona split test",
        "description": "Ends the bot's current persona split test immediately, snapshots\nperformance results, and promotes the winning persona to the bot default.\nIdempotent if the test has already been finalized.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/EndPersonaSplitTestErrorResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndPersonaSplitTestErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndPersonaSplitTestErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/EndPersonaSplitTestErrorResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndPersonaSplitTestErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndPersonaSplitTestErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/export": {
      "get": {
        "tags": [
          "Bot"
        ],
        "summary": "Export a bot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "botVersion",
            "in": "query",
            "description": "The bot version. Accepts `x.y.z` or the labelled `x.y.zs`. If not provided, the\nlatest version is exported.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ExportBotResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExportBotResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExportBotResponse"
                }
              }
            }
          }
        }
      }
    },
    "/bot/bbb/templates": {
      "get": {
        "tags": [
          "Bot"
        ],
        "summary": "Get bot builder builder templates",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/steps": {
      "get": {
        "tags": [
          "Bot"
        ],
        "summary": "Get steps for a version",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "botVersion",
            "in": "query",
            "description": "The bot version. Accepts `x.y.z` or the labelled `x.y.zs`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": { }
              },
              "application/json": {
                "schema": { }
              },
              "text/json": {
                "schema": { }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/persona-performance": {
      "get": {
        "tags": [
          "Bot"
        ],
        "summary": "Persona performance for a bot, scoped to a date range or split-test window.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "description": "Inclusive start of the performance window.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "Exclusive end of the performance window.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "splitTestId",
            "in": "query",
            "description": "Optional split-test ID (the bot ID of the 1:1 split test). Uses that\ntest's personas and, when start/end are omitted, its active window.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BotPersonaPerformanceResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotPersonaPerformanceResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotPersonaPerformanceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/GetPersonaPerformanceErrorResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetPersonaPerformanceErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetPersonaPerformanceErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/GetPersonaPerformanceErrorResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetPersonaPerformanceErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetPersonaPerformanceErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/share-preview": {
      "get": {
        "tags": [
          "Bot"
        ],
        "summary": "What a shared job flow is, for the confirmation screen someone lands on before cloning it.",
        "description": "\nDeliberately <strong>not</strong> scoped to the caller's agency. Sharing is cross-agency by\n            definition -- a link is sent to someone who does not own the flow -- so the recipient has to\n            be able to read something about it before deciding to clone. `DuplicateBot` is unscoped\n            for the same reason.\n\nIt exists so that `GET /bot/{id}` does not have to be. That endpoint returns the whole\n            Closebot.Api.Controllers.BotController.BotDto -- every version, source, variable and split test -- and it used to\n            answer for any id from any agency, which made anyone holding a bot id able to read a flow\n            they had nothing to do with. This returns the two fields the share screen actually renders\n            and nothing else.\n\nStill requires a signed-in account: a bot id is a weak secret, and this should not be a way\n            to enumerate flows anonymously.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID from the share link.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SharePreviewResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SharePreviewResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SharePreviewResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/persona-split-tests": {
      "get": {
        "tags": [
          "Bot"
        ],
        "summary": "List past persona split tests for a bot",
        "description": "Returns deactivated tests, newest first. The current test — running or\njust-ended and still marked active — stays on GET /bot/{id}.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "skip",
            "in": "query",
            "description": "Records to skip. Defaults to 0.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "take",
            "in": "query",
            "description": "Page size, clamped to Closebot.Api.Controllers.BotController.MaxSplitTestPageSize.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PersonaSplitTestPageDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PersonaSplitTestPageDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PersonaSplitTestPageDto"
                }
              }
            }
          }
        }
      }
    },
    "/bot/trash": {
      "get": {
        "tags": [
          "Bot"
        ],
        "summary": "List trashed job flows",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Bot"
        ],
        "summary": "Empty trashed job flows",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyTrashResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyTrashResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyTrashResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/bot/nodeDescriptors": {
      "get": {
        "tags": [
          "Bot"
        ],
        "summary": "Get the node descriptors",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NodeInformation"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeInformation"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeInformation"
                }
              }
            }
          }
        }
      }
    },
    "/bot/preview-import": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "Validate Flow",
        "description": "Preview and validate a KDL import without creating a bot.\nPerforms structural, referential, and graph integrity checks.",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewImportInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewImportInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewImportInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewImportResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewImportResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewImportResponse"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/publish": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "Publish a bot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PublishBotResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublishBotResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublishBotResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PublishBotResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublishBotResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublishBotResponse"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/version/{version}/restore": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "Restore an earlier version of a job flow.",
        "description": "Writes the old graph out as a <em>new</em> version rather than rewinding, so the restore is\nitself undoable. The flow also returns to the builder that version was authored in.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "description": "The version to restore. Accepts `x.y.z` or the labelled `x.y.zs`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/RestoreVersionResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestoreVersionResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestoreVersionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/save": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "Save a bot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveBotInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveBotInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SaveBotInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SaveBotResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveBotResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveBotResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SaveBotResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveBotResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveBotResponse"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/saveTools": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "Save bot tools",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ToolInputDto"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ToolInputDto"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ToolInputDto"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotToolDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotToolDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotToolDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/builder-mode": {
      "post": {
        "tags": [
          "Bot"
        ],
        "summary": "Switch builder mode",
        "description": "Switching to `Simple` is destructive: every node but the first Agent is deleted, all\nconnections are dropped, and the global prompt is replaced by a generated one. The\npre-switch graph is preserved as an earlier bot version and can be brought back with\n`POST /bot/{id}/version/{version}/restore`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetBuilderModeInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SetBuilderModeInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SetBuilderModeInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SetBuilderModeResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetBuilderModeResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetBuilderModeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SaveBotError"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveBotError"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveBotError"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{id}/version/{version}": {
      "put": {
        "tags": [
          "Bot"
        ],
        "summary": "Update a bot version",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "description": "The version ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateVersionInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateVersionInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateVersionInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/botMetric/agencySummary": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get agency summary",
        "parameters": [
          {
            "name": "sourceId",
            "in": "query",
            "description": "Optional source ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AgencyDashboardSummaryResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencyDashboardSummaryResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencyDashboardSummaryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/botMetric/actionCount": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get action count",
        "parameters": [
          {
            "name": "leadId",
            "in": "query",
            "description": "Optional lead ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "description": "Optional source ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "botId",
            "in": "query",
            "description": "Optional bot ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "description": "Optional start date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "Optional end date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              },
              "application/json": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              },
              "text/json": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }
          }
        }
      }
    },
    "/botMetric/actions": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get actions",
        "parameters": [
          {
            "name": "leadId",
            "in": "query",
            "description": "Optional lead ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "description": "Optional source ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "botId",
            "in": "query",
            "description": "Optional bot ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "description": "Optional start date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "Optional end date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "maxCount",
            "in": "query",
            "description": "Optional maximum number of actions to return.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotMetricAction"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotMetricAction"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotMetricAction"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/botMetric/agencyMetric": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get agency metric",
        "parameters": [
          {
            "name": "metric",
            "in": "query",
            "description": "The metric to get. Valid options: responses, bookings, activeSources, contacts, totalStorage, revenue.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "description": "The start date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "The end date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "resolution",
            "in": "query",
            "description": "The resolution.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "description": "Optional source ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/botMetric/bookingGraph": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get booking graph",
        "parameters": [
          {
            "name": "start",
            "in": "query",
            "description": "The start date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "The end date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "resolution",
            "in": "query",
            "description": "The resolution. Valid options are hourly, daily, or monthly.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "description": "Optional source ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/botMetric/logs": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get logs",
        "parameters": [
          {
            "name": "botId",
            "in": "query",
            "description": "Optional bot ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "description": "Optional source ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "leadId",
            "in": "query",
            "description": "Optional lead ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "description": "Optional start date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "Optional end date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "maxCount",
            "in": "query",
            "description": "Optional maximum number of logs to return.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotMetricLog"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotMetricLog"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotMetricLog"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/botMetric/messageCount": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get message count",
        "parameters": [
          {
            "name": "sourceId",
            "in": "query",
            "description": "Optional source ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "leadId",
            "in": "query",
            "description": "Optional lead ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "description": "Optional start date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "Optional end date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              },
              "application/json": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              },
              "text/json": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }
          }
        }
      }
    },
    "/botMetric/messageFeedback": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get messages with feedback",
        "parameters": [
          {
            "name": "leadId",
            "in": "query",
            "description": "The lead ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/MessageFeedbackResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageFeedbackResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageFeedbackResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Save message feedback",
        "requestBody": {
          "description": "The message feedback request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageFeedbackRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageFeedbackRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/MessageFeedbackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/botMetric/messageLikes": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get messages with likes",
        "parameters": [
          {
            "name": "leadId",
            "in": "query",
            "description": "The lead ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/MessageLikesResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageLikesResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageLikesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/botMetric/messageReason": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get message feedback reason",
        "parameters": [
          {
            "name": "messageId",
            "in": "query",
            "description": "The message ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/MessageReason"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageReason"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageReason"
                }
              }
            }
          }
        }
      }
    },
    "/botMetric/messages": {
      "get": {
        "tags": [
          "BotMetric"
        ],
        "summary": "Get messages",
        "parameters": [
          {
            "name": "sourceId",
            "in": "query",
            "description": "Optional source ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "leadId",
            "in": "query",
            "description": "Optional lead ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "description": "Optional start date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "Optional end date.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "maxCount",
            "in": "query",
            "description": "Optional maximum number of messages to return.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotMetricMessage"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotMetricMessage"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotMetricMessage"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/botVariables/{botId}/{sourceId}": {
      "get": {
        "tags": [
          "BotSourceVariable"
        ],
        "summary": "Get source variables",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotVariableDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotVariableDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotVariableDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "BotSourceVariable"
        ],
        "summary": "Update a source variable",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The list of variables to update.",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BotVariableUpdateInput"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BotVariableUpdateInput"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BotVariableUpdateInput"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/botTemplates": {
      "get": {
        "tags": [
          "BotTemplate"
        ],
        "summary": "List templates",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotTemplateDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotTemplateDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BotTemplateDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/bot/{botId}/testSession": {
      "post": {
        "tags": [
          "BotTesting"
        ],
        "summary": "Create a test session",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TestSession"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestSession"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestSession"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "BotTesting"
        ],
        "summary": "List test sessions",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "The offset.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "maxCount",
            "in": "query",
            "description": "The maximum count.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ListLeadDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListLeadDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListLeadDto"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{botId}/testSession/{leadId}": {
      "delete": {
        "tags": [
          "BotTesting"
        ],
        "summary": "Delete a test session",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "leadId",
            "in": "path",
            "description": "The lead ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "BotTesting"
        ],
        "summary": "Update a test session",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "The lead ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "botId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The update session input.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSessionInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSessionInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSessionInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateSessionDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateSessionDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateSessionDto"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{botId}/testSession/{leadId}/force-step": {
      "post": {
        "tags": [
          "BotTesting"
        ],
        "summary": "Force processing",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "The lead ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "botId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/bot/{botId}/testSession/messages/{leadId}": {
      "get": {
        "tags": [
          "BotTesting"
        ],
        "summary": "Listen for messages",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "leadId",
            "in": "path",
            "description": "The lead ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/bot/{botId}/testSession/{leadId}/rollback": {
      "post": {
        "tags": [
          "BotTesting"
        ],
        "summary": "Rollback a test session",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "botId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BotTestingRollbackInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BotTestingRollbackInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BotTestingRollbackInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BotTestingRollbackOutput"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotTestingRollbackOutput"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotTestingRollbackOutput"
                }
              }
            }
          }
        }
      }
    },
    "/bot/{botId}/testSession/message": {
      "post": {
        "tags": [
          "BotTesting"
        ],
        "summary": "Send a message to a test session",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The bot ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestSessionMessageInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TestSessionMessageInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TestSessionMessageInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/dashboard": {
      "post": {
        "tags": [
          "Dashboard"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDashboardInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDashboardInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDashboardInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Dashboard"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DashboardDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DashboardDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DashboardDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/dashboard/{id}": {
      "delete": {
        "tags": [
          "Dashboard"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Dashboard"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Dashboard"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDashboardInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDashboardInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDashboardInput"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/hierarchy": {
      "post": {
        "tags": [
          "Hierarchy"
        ],
        "summary": "Add a folder",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddHierarchyInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AddHierarchyInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AddHierarchyInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AddHierarchyOutput"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddHierarchyOutput"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddHierarchyOutput"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Hierarchy"
        ],
        "summary": "List folders",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ListHierarchyResult"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ListHierarchyResult"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ListHierarchyResult"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/hierarchy/{id}": {
      "delete": {
        "tags": [
          "Hierarchy"
        ],
        "summary": "Delete a folder",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the folder to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Hierarchy"
        ],
        "summary": "Get a folder",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the folder to get.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ListHierarchyResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListHierarchyResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListHierarchyResult"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Hierarchy"
        ],
        "summary": "Update a folder",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the folder to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HierarchyInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/HierarchyInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/HierarchyInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/lead/{leadId}/ai-toggle": {
      "get": {
        "tags": [
          "Lead"
        ],
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LeadAiToggleDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadAiToggleDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadAiToggleDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Lead"
        ],
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadAiToggleUpdateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadAiToggleUpdateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LeadAiToggleUpdateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LeadAiToggleDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadAiToggleDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadAiToggleDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/lead/{leadId}": {
      "delete": {
        "tags": [
          "Lead"
        ],
        "summary": "Delete a lead",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "The ID of the lead to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Lead"
        ],
        "summary": "Get a lead",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "The ID of the lead to get.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeExternal",
            "in": "query",
            "description": "Include external fields of the lead in the result (fields from the CRM).",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Lead"
        ],
        "summary": "Update lead fields",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "The ID of the lead to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadUpdateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadUpdateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LeadUpdateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/lead/{leadId}/page-history": {
      "get": {
        "tags": [
          "Lead"
        ],
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadHistoryEventDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadHistoryEventDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadHistoryEventDto"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/lead/{leadId}/topics": {
      "get": {
        "tags": [
          "Lead"
        ],
        "summary": "The topics a lead's conversation has been classified into.",
        "description": "Unpaginated, no limit: the taxonomy is capped at 30 Active topics per agency\n(see the remark on /analytics/topics/options), and LeadTopics is unique on\n(LeadId, TopicId), so a lead's list is bounded well under any page size.\n            \nDeliberately not gated on the analytics add-on, unlike /analytics/topics.\nThe contact card's Topics tab is shown to every agency, so this stays on the\nordinary AgencyUser policy inherited from the controller.\n            \nFor the same reason org:client is *narrowed* to its own sources rather than\nrejected outright the way the analytics endpoints reject it: a client who can\nopen the conversation should see what it was about.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadTopicDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadTopicDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadTopicDto"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/lead": {
      "get": {
        "tags": [
          "Lead"
        ],
        "summary": "List leads",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "The page number.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "The page size.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "sourceId",
            "in": "query",
            "description": "The source ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "leadId",
            "in": "query",
            "description": "The lead ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LeadListResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadListResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadListResultDto"
                }
              }
            }
          }
        }
      }
    },
    "/lead/{leadId}/note": {
      "post": {
        "tags": [
          "Lead"
        ],
        "summary": "Leave an internal note on a conversation. Notes are not messages: they\nare never sent to the contact and are only included in the AI's context\nwhen marked AiVisible.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateNoteInputDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateNoteInputDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateNoteInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NoteResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteResultDto"
                }
              }
            }
          }
        }
      }
    },
    "/lead/{leadId}/note/{noteId}": {
      "patch": {
        "tags": [
          "Lead"
        ],
        "summary": "Update an internal note's body and/or AI visibility.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "noteId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateNoteInputDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateNoteInputDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateNoteInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NoteResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteResultDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Lead"
        ],
        "summary": "Delete an internal note. Only the note's author may delete it.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "noteId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/lead/{leadId}/scheduled-message": {
      "post": {
        "tags": [
          "Lead"
        ],
        "summary": "Schedule a message to a lead for a future time — either a manually\ntyped message or one generated at send time by the conversation's\nlast-responding AI agent.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateScheduledMessageInputDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateScheduledMessageInputDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateScheduledMessageInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledMessageDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledMessageDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledMessageDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Lead"
        ],
        "summary": "List a lead's scheduled messages: everything pending, plus recent\nfailures so they stay visible in the conversation.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ScheduledMessageDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ScheduledMessageDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ScheduledMessageDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lead/{leadId}/scheduled-message/{scheduledMessageId}": {
      "patch": {
        "tags": [
          "Lead"
        ],
        "summary": "Update a pending scheduled message's time, body (manual only), or\ncancel-on-reply flag. Creator or team members only.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scheduledMessageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateScheduledMessageInputDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateScheduledMessageInputDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateScheduledMessageInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledMessageDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledMessageDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledMessageDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Lead"
        ],
        "summary": "Cancel a pending scheduled message, or dismiss a failed one. Creator\nor team members only. The row is kept (status \"canceled\") for\nauditability; a dismissed failure keeps its original StatusReason.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scheduledMessageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/lead/search": {
      "post": {
        "tags": [
          "Lead"
        ],
        "summary": "Search leads",
        "requestBody": {
          "description": "The search query input.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchQueryInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchQueryInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SearchQueryInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SearchLeadResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchLeadResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchLeadResultDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/lead/{leadId}/send-message": {
      "post": {
        "tags": [
          "Lead"
        ],
        "summary": "Send a message to a lead",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessageInputDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessageInputDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessageInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SendMessageResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendMessageResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendMessageResultDto"
                }
              }
            }
          }
        }
      }
    },
    "/lead/{leadId}/typing": {
      "post": {
        "tags": [
          "Lead"
        ],
        "summary": "Broadcast human typing state to live subscribers for a lead.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadTypingInputDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadTypingInputDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LeadTypingInputDto"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          }
        }
      }
    },
    "/lead/{leadId}/instance/{botId}": {
      "put": {
        "tags": [
          "Lead"
        ],
        "summary": "Update a lead instance",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "The ID of the lead to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "botId",
            "in": "path",
            "description": "The ID of the bot to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The update instance input.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InstanceUpdateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/InstanceUpdateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/InstanceUpdateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/leaderboard/board": {
      "get": {
        "tags": [
          "Leaderboard"
        ],
        "summary": "One leaderboard: the leaders, the caller's neighbourhood, and where the caller stands.",
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "description": "\"source\" ranks individual sources, \"agency\" ranks whole accounts.",
            "schema": {
              "type": "string",
              "default": "source"
            }
          },
          {
            "name": "metric",
            "in": "query",
            "description": "A key from GET /leaderboard/metrics.",
            "schema": {
              "type": "string",
              "default": "bookings"
            }
          },
          {
            "name": "compare",
            "in": "query",
            "description": "Who to rank against: \"all\" (default), or \"industry\" for the subject's own vertical.\n            \nA mode, not an industry key. The server resolves which vertical the subject belongs to, so\na caller can ask to be compared within it without ever learning — or naming — which one it\nis. Not valid with scope=agency: industry is a property of a source. Falls back to \"all\"\nwhen no board was published for the subject's vertical this period, which\nClosebot.Api.Controllers.LeaderboardController.GetBoardResponse.IndustryAvailable reports.",
            "schema": {
              "type": "string",
              "default": "all"
            }
          },
          {
            "name": "period",
            "in": "query",
            "description": "\"current\" (default) or \"previous\".",
            "schema": {
              "type": "string",
              "default": "current"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "description": "Which of the caller's own entities Closebot.Api.Controllers.LeaderboardController.GetBoardResponse.Me,\nClosebot.Api.Controllers.LeaderboardController.GetBoardResponse.Around and the eligibility describe. Defaults to their\nbest-placed one. Ignored at agency scope, where the caller has exactly one entity. A source\nbelonging to another agency is rejected.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "How many leaders to return. 1-10, default 10.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 10
            }
          },
          {
            "name": "around",
            "in": "query",
            "description": "How many neighbours either side of the caller. 0-5, default 5.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/GetBoardResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetBoardResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetBoardResponse"
                }
              }
            }
          }
        }
      }
    },
    "/leaderboard/profile": {
      "get": {
        "tags": [
          "Leaderboard"
        ],
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "source"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "compare",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "all"
            }
          },
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "current"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/GetProfileResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetProfileResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetProfileResponse"
                }
              }
            }
          }
        }
      }
    },
    "/leaderboard/metrics": {
      "get": {
        "tags": [
          "Leaderboard"
        ],
        "summary": "The metrics a board can be ranked by. Clients should build their columns from this rather\nthan hardcoding a list, so changing the headline set needs no frontend deploy.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeaderboardMetricDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeaderboardMetricDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeaderboardMetricDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/library/files/{fileId}/source/{sourceId}": {
      "post": {
        "tags": [
          "Library"
        ],
        "summary": "Attach a file to a source",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "The ID of the file to attach.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "description": "The ID of the source to attach the file to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Library"
        ],
        "summary": "Detach a file from a source",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "The ID of the file to detach.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceId",
            "in": "path",
            "description": "The ID of the source to detach the file from.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/library/files/{fileId}": {
      "delete": {
        "tags": [
          "Library"
        ],
        "summary": "Delete a file",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "The ID of the file to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Library"
        ],
        "summary": "Get a file metadata",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "The ID of the file to get.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/FileDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Library"
        ],
        "summary": "Replace file content",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "The ID of the file to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "newFile": {
                    "type": "string",
                    "description": "The new file.",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "newFile": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/library/external/{provider}/connections": {
      "post": {
        "tags": [
          "Library"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalConnectInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalConnectInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalConnectInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalConnectionDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalConnectionDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalConnectionDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Library"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalConnectionDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalConnectionDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalConnectionDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/library/external/{provider}/connections/{connectionId}/connectable-items": {
      "get": {
        "tags": [
          "Library"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalConnectableItemDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalConnectableItemDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalConnectableItemDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/library/external/{provider}/connections/{connectionId}/resources": {
      "post": {
        "tags": [
          "Library"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalSyncInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalSyncInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalSyncInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalResourceSyncDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalResourceSyncDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalResourceSyncDto"
                }
              }
            }
          }
        }
      }
    },
    "/library/external/{provider}/resources": {
      "get": {
        "tags": [
          "Library"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalResourceSyncDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalResourceSyncDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalResourceSyncDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/library/external/{provider}/resources/{resourceId}/items": {
      "get": {
        "tags": [
          "Library"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalResourceItemSyncDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalResourceItemSyncDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExternalResourceItemSyncDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/library/external/{provider}/resources/{resourceId}": {
      "delete": {
        "tags": [
          "Library"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/library/files/{fileId}/scrape-pages": {
      "get": {
        "tags": [
          "Library"
        ],
        "summary": "Get the scrape pages for a file",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "The ID of the file to get the scrape pages for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebscrapePageDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebscrapePageDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebscrapePageDto"
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Library"
        ],
        "summary": "Update the scrape pages for a file",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "The ID of the file to update the scrape pages for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The input containing the new scrape pages.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebscrapePageUpdateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/WebscrapePageUpdateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/WebscrapePageUpdateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/library/files": {
      "get": {
        "tags": [
          "Library"
        ],
        "summary": "List files",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FileDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FileDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FileDto"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Library"
        ],
        "summary": "Upload a file",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "description": "The file to upload.",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "file": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/library/files/{fileId}/preview": {
      "get": {
        "tags": [
          "Library"
        ],
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/FilePreviewDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FilePreviewDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/FilePreviewDto"
                }
              }
            }
          }
        }
      }
    },
    "/library/webscrape": {
      "post": {
        "tags": [
          "Library"
        ],
        "summary": "Create a Web-Scrape file",
        "requestBody": {
          "description": "The input containing the webscrape information.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadWebscrapeToSourceInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadWebscrapeToSourceInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UploadWebscrapeToSourceInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/library/files/{fileId}/view": {
      "get": {
        "tags": [
          "Library"
        ],
        "summary": "Get file content",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "The ID of the file to view.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/bot-live-demo/{botId}": {
      "post": {
        "tags": [
          "LiveDemo"
        ],
        "summary": "Create Live Demo",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The ID of the Bot",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LiveDemoCreateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LiveDemoCreateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LiveDemoCreateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "LiveDemo"
        ],
        "summary": "List Live Demos",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The ID of the Bot",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LiveDemoDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LiveDemoDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LiveDemoDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/bot-live-demo/live/{key}/session": {
      "post": {
        "tags": [
          "LiveDemo"
        ],
        "summary": "Create Live Demo Session",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "The key of the demo",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoSessionDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoSessionDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoSessionDto"
                }
              }
            }
          }
        }
      }
    },
    "/bot-live-demo/{botId}/{key}": {
      "delete": {
        "tags": [
          "LiveDemo"
        ],
        "summary": "Delete Live Demo",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The ID of the Bot",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "path",
            "description": "The key of the live demo",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "LiveDemo"
        ],
        "summary": "Update Live Demo",
        "parameters": [
          {
            "name": "botId",
            "in": "path",
            "description": "The ID of the Bot",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "path",
            "description": "The key of the live demo",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LiveDemoCreateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LiveDemoCreateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LiveDemoCreateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              }
            }
          }
        }
      }
    },
    "/bot-live-demo/live/{key}": {
      "get": {
        "tags": [
          "LiveDemo"
        ],
        "summary": "Get Live Demo",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "The key of the demo",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveDemoDto"
                }
              }
            }
          }
        }
      }
    },
    "/bot-live-demo/live/{key}/session/{sessionLeadId}": {
      "get": {
        "tags": [
          "LiveDemo"
        ],
        "summary": "Get Live Demo Lead",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "The key of the demo",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionLeadId",
            "in": "path",
            "description": "The session lead ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "tags": [
          "LiveDemo"
        ],
        "summary": "Update Live Demo Fields",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "The key of the demo",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionLeadId",
            "in": "path",
            "description": "The session lead ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadUpdateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadUpdateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LeadUpdateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/bot-live-demo/live/{key}/session/{sessionLeadId}/message": {
      "post": {
        "tags": [
          "LiveDemo"
        ],
        "summary": "Stream Live Demo Messages",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "The key of the demo",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionLeadId",
            "in": "path",
            "description": "The session lead ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LiveDemoMessageInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LiveDemoMessageInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LiveDemoMessageInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/bot-live-demo/live/{key}/session/{sessionLeadId}/stream": {
      "get": {
        "tags": [
          "LiveDemo"
        ],
        "summary": "Stream Live Demo Messages",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "The key of the demo",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionLeadId",
            "in": "path",
            "description": "The session lead ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/notifications/{id}": {
      "delete": {
        "tags": [
          "Notification"
        ],
        "summary": "Delete a notification",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "default": {
            "description": "Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Notification"
        ],
        "summary": "Update a notification",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the notification to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The notification update input.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationUpdateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationUpdateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationUpdateDto"
              }
            }
          }
        },
        "responses": {
          "default": {
            "description": "Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationDto"
                }
              }
            }
          }
        }
      }
    },
    "/notifications/email-preferences": {
      "get": {
        "tags": [
          "Notification"
        ],
        "summary": "Get the caller's own transactional email preferences for the active agency.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/EmailPreferencesDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailPreferencesDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailPreferencesDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Notification"
        ],
        "summary": "Update the caller's own transactional email preferences.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEmailPreferencesDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEmailPreferencesDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEmailPreferencesDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/EmailPreferencesDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailPreferencesDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailPreferencesDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/notifications": {
      "get": {
        "tags": [
          "Notification"
        ],
        "summary": "List notifications",
        "responses": {
          "default": {
            "description": "Error",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/NotificationDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/NotificationDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/NotificationDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/notifications/webhook-endpoints": {
      "get": {
        "tags": [
          "Notification"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpointDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpointDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpointDto"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Notification"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookEndpointDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookEndpointDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookEndpointDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointDto"
                }
              }
            }
          }
        }
      }
    },
    "/notifications/webhook-endpoints/{id}": {
      "put": {
        "tags": [
          "Notification"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookEndpointDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookEndpointDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookEndpointDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Notification"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        }
      }
    },
    "/notifications/categories/{categoryKey}/webhooks": {
      "put": {
        "tags": [
          "Notification"
        ],
        "parameters": [
          {
            "name": "categoryKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCategoryWebhooksDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCategoryWebhooksDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SetCategoryWebhooksDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpointDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpointDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpointDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/notifications/categories/{categoryKey}/webhook-sample": {
      "get": {
        "tags": [
          "Notification"
        ],
        "parameters": [
          {
            "name": "categoryKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSampleDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSampleDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSampleDto"
                }
              }
            }
          }
        }
      }
    },
    "/persona": {
      "post": {
        "tags": [
          "Persona"
        ],
        "summary": "Create a new persona",
        "requestBody": {
          "description": "The persona input.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePersonaInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePersonaInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePersonaInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Persona"
        ],
        "summary": "List personas",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PersonaDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PersonaDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PersonaDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/persona/{id}": {
      "delete": {
        "tags": [
          "Persona"
        ],
        "summary": "Delete a persona",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the persona to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Persona"
        ],
        "summary": "Get a persona",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the persona to get.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PersonaDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PersonaDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PersonaDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Persona"
        ],
        "summary": "Update a persona",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the persona to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The persona input.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePersonaInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePersonaInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePersonaInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PersonaDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PersonaDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PersonaDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/report": {
      "post": {
        "tags": [
          "Report"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReportInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReportInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReportInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ReportDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Report"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/report/{id}": {
      "delete": {
        "tags": [
          "Report"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Report"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateReportInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateReportInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateReportInput"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/report/{id}/shares": {
      "get": {
        "tags": [
          "Report"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportShareDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportShareDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportShareDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Report"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportSharesInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportSharesInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ReportSharesInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportShareDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportShareDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportShareDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Report"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportSharesInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportSharesInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ReportSharesInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportShareDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportShareDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReportShareDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/report/{id}/shares/{accountId}": {
      "delete": {
        "tags": [
          "Report"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/smart-faq/answered-followup": {
      "post": {
        "tags": [
          "SmartFAQ"
        ],
        "summary": "Follow up on answered FAQs",
        "requestBody": {
          "description": "The request containing a list of lead IDs.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnsweredFAQFollowUpRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AnsweredFAQFollowUpRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AnsweredFAQFollowUpRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/smart-faq/answer": {
      "post": {
        "tags": [
          "SmartFAQ"
        ],
        "summary": "Answer multiple FAQs",
        "requestBody": {
          "description": "The answer multiple FAQs request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnswerMultipleFAQsRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AnswerMultipleFAQsRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AnswerMultipleFAQsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SmartFAQDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SmartFAQDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SmartFAQDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/smart-faq": {
      "post": {
        "tags": [
          "SmartFAQ"
        ],
        "summary": "Create a new FAQ",
        "requestBody": {
          "description": "The create FAQ request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSmartFAQRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSmartFAQRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSmartFAQRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      },
      "get": {
        "tags": [
          "SmartFAQ"
        ],
        "summary": "List FAQs",
        "parameters": [
          {
            "name": "sourceId",
            "in": "query",
            "description": "The source ID of the FAQs.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "The state of the FAQs. \"compressed\" or \"uncompressed\".",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "answered",
            "in": "query",
            "description": "The answered status of the FAQs. \"answered\" or \"unanswered\".",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SmartFAQDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SmartFAQDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SmartFAQDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/smart-faq/{id}": {
      "delete": {
        "tags": [
          "SmartFAQ"
        ],
        "summary": "Delete an FAQ",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the FAQ to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source": {
      "post": {
        "tags": [
          "Source"
        ],
        "summary": "Add a source",
        "requestBody": {
          "description": "Source information.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddSourceInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AddSourceInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AddSourceInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "List sources",
        "description": "Retrieves sources within the current agency.",
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "description": "Size of each page (max 100)",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "The page number. For example, page 5 with page size of 20 would start at offset 100.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "query",
            "in": "query",
            "description": "Search by source name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Search by only specific categories (GHL, HubSpot, WebHook, etc)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "description": "How results should be ordered. \"+\" or \"-\" prefix to specific ascending or descending.",
            "schema": {
              "type": "string",
              "default": "+id"
            }
          },
          {
            "name": "forceTokenRefresh",
            "in": "query",
            "description": "When true, access token for all returned sources are refreshed.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDtoPaginated"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDtoPaginated"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDtoPaginated"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{id}": {
      "delete": {
        "tags": [
          "Source"
        ],
        "summary": "Delete a source",
        "description": "Deletes a source and all associated information from Closebot.\n\nCan also attempts to uninstall the Closebot app from the external CRM.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "uninstall",
            "in": "query",
            "description": "Whether to uninstall from the CRM as well.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "Get a source",
        "description": "Retrieves information for a single source.",
        "operationId": "Get a source",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The source ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{id}/owners": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "List HubSpot owners",
        "description": "Returns the list of HubSpot users (owners) available as message senders for a HubSpot source.\nReturns an empty list for non-HubSpot sources.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceOwnerDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceOwnerDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceOwnerDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{id}/calendars": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "List source calendars",
        "description": "Lists all calendars attached to a source.\n\nThis will return both manually added calendars and calendars from the external CRM.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceCalendarDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceCalendarDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceCalendarDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{id}/channels": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "List source channels",
        "description": "Lists all channels available to a source.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceChannelDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceChannelDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceChannelDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{id}/fields": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "List source fields",
        "description": "",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SourceFieldCollectionDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceFieldCollectionDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceFieldCollectionDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{id}/tags": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "List source tags",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceTagDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceTagDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceTagDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{id}/replaced-by/{newSourceId}": {
      "post": {
        "tags": [
          "Source"
        ],
        "summary": "Replace a source with another",
        "description": "This changes your source type. It is destructive: the old source's\ncontacts, conversations, message history, chat widgets and availability windows are all\ndeleted, and the CloseBot app is uninstalled from the old CRM.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The source being replaced. Deleted by this call.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "newSourceId",
            "in": "path",
            "description": "The already-connected source to move everything onto.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ReplaceSourceResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplaceSourceResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplaceSourceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}": {
      "put": {
        "tags": [
          "Source"
        ],
        "summary": "Update a source",
        "description": "Updates fields in a source.\n\nOnly non-null fields are updated. Any missing or null field is ignored.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to update.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSourceInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSourceInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSourceInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/webhook-integration": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "Get the webhook integration configuration for a source",
        "description": "Returns the setup wizard configuration. The external API key itself is\nnever returned, only whether one is saved.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/custom-channels/{channelId}/webhook-integration": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "Get a Custom Channel's setup wizard configuration",
        "description": "The external API key itself is never returned, only whether one is saved.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelId",
            "in": "path",
            "description": "The Custom Channel ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/webhook-integration/events": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "List captured webhook events",
        "description": "Returns up to 3 events captured while the source was in listen mode,\nnewest first. The setup wizard polls this endpoint.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CapturedWebhookEventsResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapturedWebhookEventsResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapturedWebhookEventsResult"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/custom-channels/{channelId}/webhook-integration/events": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "List a Custom Channel's captured events",
        "description": "Returns up to 3 events the channel captured while listening, newest\nfirst. The setup wizard polls this endpoint.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelId",
            "in": "path",
            "description": "The Custom Channel ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CapturedWebhookEventsResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapturedWebhookEventsResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapturedWebhookEventsResult"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/webhook-integration/contact-fetch": {
      "put": {
        "tags": [
          "Source"
        ],
        "summary": "Save the contact fetch configuration",
        "description": "Saves the optional request executed on inbound messages to fetch\ncontact details (typically a GET with {{contactId}}), plus the mapping\nof contact field descriptors to JSON paths within its response body.\nPassing a null template disables contact fetching.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The contact fetch configuration to save.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookContactFetchInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookContactFetchInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookContactFetchInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/custom-channels/{channelId}/webhook-integration/contact-fetch": {
      "put": {
        "tags": [
          "Source"
        ],
        "summary": "Save a Custom Channel's contact fetch configuration",
        "description": "Saves the optional request executed on the channel's inbound messages\nto fetch contact details, plus the mapping of contact field descriptors\nto JSON paths within its response body. Passing a null template\ndisables contact fetching.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelId",
            "in": "path",
            "description": "The Custom Channel ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The contact fetch configuration to save.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookContactFetchInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookContactFetchInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookContactFetchInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/webhook-integration/inbound": {
      "put": {
        "tags": [
          "Source"
        ],
        "summary": "Save the inbound webhook mapping",
        "description": "Saves the JSON path mapping, filter key and token requirement.\nPassing a null mapping reverts inbound processing to the legacy packet\nformat (kind/contactId/body).",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The mapping to save.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookInboundInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookInboundInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookInboundInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/custom-channels/{channelId}/webhook-integration/inbound": {
      "put": {
        "tags": [
          "Source"
        ],
        "summary": "Save a Custom Channel's inbound mapping",
        "description": "Saves the channel's JSON path mapping, filter key and \"Require access\ntoken\" setting. Passing a null mapping reverts the channel's inbound\nprocessing to the legacy packet format (kind/contactId/body).",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelId",
            "in": "path",
            "description": "The Custom Channel ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The mapping to save.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookInboundInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookInboundInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookInboundInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/webhook-integration/outbound": {
      "put": {
        "tags": [
          "Source"
        ],
        "summary": "Save the outbound webhook configuration",
        "description": "Mode \"legacy\" POSTs bot events to the callback URL; mode \"templates\"\nexecutes the saved HTTP request templates directly against the external\nAPI. For the external API key: null leaves it unchanged, an empty\nstring clears it.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The outbound configuration.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookOutboundInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookOutboundInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookOutboundInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/custom-channels/{channelId}/webhook-integration/outbound": {
      "put": {
        "tags": [
          "Source"
        ],
        "summary": "Save a Custom Channel's outbound configuration",
        "description": "Mode \"legacy\" POSTs bot events to the channel's callback URL; mode\n\"templates\" executes the channel's saved HTTP request templates\ndirectly against the external API. For the external API key: null\nleaves it unchanged, an empty string clears it.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "description": "The source ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelId",
            "in": "path",
            "description": "The Custom Channel ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The outbound configuration.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookOutboundInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookOutboundInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookOutboundInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIntegrationDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/custom-channels/{channelId}/commit": {
      "post": {
        "tags": [
          "SourceChannel"
        ],
        "summary": "Commit a draft Custom Channel, so events at its catch URL start being\nprocessed. Committing an already committed channel changes nothing.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/custom-channels": {
      "post": {
        "tags": [
          "SourceChannel"
        ],
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSourceChannelInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSourceChannelInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSourceChannelInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "SourceChannel"
        ],
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgencySourceChannelDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgencySourceChannelDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgencySourceChannelDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agency/source/{sourceId}/custom-channels/{channelId}": {
      "delete": {
        "tags": [
          "SourceChannel"
        ],
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "SourceChannel"
        ],
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "SourceChannel"
        ],
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSourceChannelInput"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSourceChannelInput"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSourceChannelInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgencySourceChannelDto"
                }
              }
            }
          }
        }
      }
    },
    "/webhook/event/{endpointKey}": {
      "post": {
        "tags": [
          "Webhook"
        ],
        "summary": "Send a webhook event",
        "parameters": [
          {
            "name": "endpointKey",
            "in": "path",
            "description": "The endpoint key: a Custom Channel's key, or (during the transition to\nCustom Channels) a blank source's key.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The body of the webhook event.",
          "content": {
            "application/json": {
              "schema": { }
            },
            "text/json": {
              "schema": { }
            },
            "application/*+json": {
              "schema": { }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccountNotificationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "kind": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "body": {
            "type": "string",
            "nullable": true
          },
          "viewed": {
            "type": "boolean"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "metadata": {
            "$ref": "#/components/schemas/AccountNotificationMetadata"
          }
        },
        "additionalProperties": false
      },
      "AccountNotificationMetadata": {
        "type": "object",
        "properties": {
          "leadId": {
            "type": "string",
            "nullable": true
          },
          "noteId": {
            "type": "string",
            "nullable": true
          },
          "mentionedByAccountId": {
            "type": "string",
            "nullable": true
          },
          "mentionedByName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AccountNotificationUpdateDto": {
        "type": "object",
        "properties": {
          "viewed": {
            "type": "boolean",
            "description": "Whether the notification has been viewed"
          }
        },
        "additionalProperties": false
      },
      "AddHierarchyInput": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the folder",
            "nullable": true
          },
          "parentId": {
            "type": "string",
            "description": "The parent ID of the folder",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AddHierarchyOutput": {
        "required": [
          "id"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The ID of the folder",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AddSourceInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "type": "string",
            "nullable": true
          },
          "key": {
            "type": "string",
            "nullable": true
          },
          "accessToken": {
            "type": "string",
            "nullable": true
          },
          "refreshToken": {
            "type": "string",
            "nullable": true
          },
          "expiresIn": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "autoShutoff": {
            "type": "boolean",
            "nullable": true
          },
          "gracefulGoodbye": {
            "type": "boolean",
            "nullable": true
          },
          "summarizeAttachments": {
            "type": "boolean",
            "nullable": true
          },
          "webhookCallback": {
            "type": "string",
            "nullable": true
          },
          "timezone": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AddSourceTransactionDto": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AgencyDashboardSummaryResponse": {
        "type": "object",
        "properties": {
          "currentMonthMessageCount": {
            "type": "integer",
            "description": "The number of messages sent to leads in the current month",
            "format": "int32"
          },
          "lastMonthMessageCount": {
            "type": "integer",
            "description": "The number of messages sent to leads in the last month",
            "format": "int32"
          },
          "totalStorage": {
            "type": "number",
            "description": "The total storage used by the agency",
            "format": "double"
          },
          "currentMonthSuccessfulBookings": {
            "type": "integer",
            "description": "The number of successful bookings in the current month",
            "format": "int32"
          },
          "lastMonthSuccessfulBookings": {
            "type": "integer",
            "description": "The number of successful bookings in the last month",
            "format": "int32"
          },
          "currentMonthActiveSources": {
            "type": "integer",
            "description": "The number of active sources in the current month",
            "format": "int32"
          },
          "lastMonthActiveSources": {
            "type": "integer",
            "description": "The number of active sources in the last month",
            "format": "int32"
          },
          "currentUsers": {
            "type": "integer",
            "description": "The number of users in the current month",
            "format": "int32"
          },
          "currentMonthContacts": {
            "type": "integer",
            "description": "The number of leads in the current month",
            "format": "int32"
          },
          "lastMonthContacts": {
            "type": "integer",
            "description": "The number of leads in the last month",
            "format": "int32"
          },
          "currentMonthRespondedContacts": {
            "type": "integer",
            "description": "Distinct leads who sent at least one inbound message this month",
            "format": "int32"
          },
          "currentMonthFollowUpsFromNoResponse": {
            "type": "integer",
            "description": "Current-month contacts with no response that have a follow-up scheduled",
            "format": "int32"
          },
          "currentMonthFollowUpsFromResponded": {
            "type": "integer",
            "description": "Current-month contacts that responded (no booking) with a follow-up scheduled",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "AgencyDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "betaTester": {
            "type": "boolean"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgencyMemberDto"
            },
            "nullable": true
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "sourceCount": {
            "type": "integer",
            "format": "int32"
          },
          "simplifiedShell": {
            "type": "boolean"
          },
          "soleSourceId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AgencyMemberDto": {
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "nullable": true
          },
          "role": {
            "type": "string",
            "nullable": true
          },
          "authId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AgencyNotificationMetadata": {
        "type": "object",
        "properties": {
          "aiProviderId": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "botId": {
            "type": "string",
            "nullable": true
          },
          "rawAiError": {
            "type": "string",
            "nullable": true
          },
          "failureReason": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AgencySourceChannelDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "friendlyName": {
            "type": "string",
            "nullable": true
          },
          "provider": {
            "type": "string",
            "nullable": true
          },
          "uniqueId": {
            "type": "string",
            "nullable": true
          },
          "authToken": {
            "type": "string",
            "nullable": true
          },
          "expiration": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "callbackUri": {
            "type": "string",
            "nullable": true
          },
          "isDraft": {
            "type": "boolean"
          },
          "projectId": {
            "type": "string",
            "nullable": true
          },
          "appId": {
            "type": "string",
            "nullable": true
          },
          "region": {
            "type": "string",
            "nullable": true
          },
          "conversationChannel": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AgencySourceFAQState": {
        "enum": [
          "Uncompressed",
          "Compressed"
        ],
        "type": "integer",
        "format": "int32"
      },
      "AiCostBreakdownDto": {
        "type": "object",
        "properties": {
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "standard": {
            "$ref": "#/components/schemas/AiCostStandardDto"
          },
          "metered": {
            "$ref": "#/components/schemas/AiCostMeteredDto"
          }
        },
        "additionalProperties": false
      },
      "AiCostMeteredDto": {
        "type": "object",
        "properties": {
          "calls": {
            "type": "integer",
            "format": "int32"
          },
          "segments": {
            "type": "number",
            "format": "double"
          },
          "shares": {
            "$ref": "#/components/schemas/AiCostSharesDto"
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiCostToolDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AiCostSharesDto": {
        "type": "object",
        "properties": {
          "globalPromptBase": {
            "type": "number",
            "format": "double"
          },
          "nodePrompting": {
            "type": "number",
            "format": "double"
          },
          "toolDescriptions": {
            "type": "number",
            "format": "double"
          },
          "knowledgeBase": {
            "type": "number",
            "format": "double"
          },
          "toolCallResults": {
            "type": "number",
            "format": "double"
          },
          "conversationHistory": {
            "type": "number",
            "format": "double"
          },
          "responseFormat": {
            "type": "number",
            "format": "double"
          },
          "thinking": {
            "type": "number",
            "format": "double"
          },
          "toolCallsEmitted": {
            "type": "number",
            "format": "double"
          },
          "message": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "AiCostStandardDto": {
        "type": "object",
        "properties": {
          "calls": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "AiCostToolDto": {
        "type": "object",
        "properties": {
          "apiName": {
            "type": "string",
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "nullable": true
          },
          "isCustom": {
            "type": "boolean"
          },
          "share": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "AiCreateBotInput": {
        "required": [
          "description",
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the new bot",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "The prompt to use to create the new bot",
            "nullable": true
          },
          "category": {
            "type": "string",
            "description": "The source category of the new bot (GHL, WebHook, etc.)",
            "nullable": true
          },
          "folderId": {
            "type": "string",
            "description": "The folder/group to place the newly created bot",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AnalyticsDimensionDto": {
        "required": [
          "key",
          "label",
          "valueSource"
        ],
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Wire name to send in `filters.dimensions[].dimension` or `groupBy`.",
            "nullable": true
          },
          "label": {
            "type": "string",
            "description": "What to call it in the UI. The detail dimensions are named per metric — \"Tool\",\n\"Document Type\", \"AI Provider\" — which is the point of them.",
            "nullable": true
          },
          "valueSource": {
            "type": "string",
            "description": "Where to load the value list: \"channel\", \"bot\", \"persona\" or \"endpoint\". All of them\nare served by GET /analytics/dimensions/{key}/values; the hint just lets a client\ncache the shared ones across metrics.",
            "nullable": true
          },
          "minResolution": {
            "type": "string",
            "description": "Set when slicing by this dimension coarsens the finest bucket available, beyond the\nmetric's own `minResolution`. Page Views is recorded every 15 minutes, but only\ndaily once broken down by page.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AnalyticsDimensionValueDto": {
        "required": [
          "label",
          "value"
        ],
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "description": "Raw value to send back in a filter. The empty string means \"unknown\".",
            "nullable": true
          },
          "label": {
            "type": "string",
            "description": "What to show in the dropdown.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AnalyticsFormulaRequest": {
        "required": [
          "expression"
        ],
        "type": "object",
        "properties": {
          "expression": {
            "type": "string",
            "description": "Arithmetic over catalog metrics, with operands in square brackets — for example\n`([aiResponses] / [bookings]) * 100`. Supports + - * / and parentheses.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AnalyticsMetricDto": {
        "required": [
          "aggregation",
          "category",
          "description",
          "dimensions",
          "distinctCount",
          "format",
          "icon",
          "key",
          "label",
          "locked",
          "supportsSourceSplit"
        ],
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Wire key to pass as `metric` on POST /analytics/query.",
            "nullable": true
          },
          "label": {
            "type": "string",
            "description": "Display name.",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "What the metric counts, and anything it deliberately excludes.",
            "nullable": true
          },
          "category": {
            "type": "string",
            "description": "Group heading for the metric picker. Categories should be rendered in the order they\nfirst appear in this response rather than sorted.",
            "nullable": true
          },
          "icon": {
            "type": "string",
            "description": "Semantic icon name (e.g. \"clock\", \"currency\"). Clients map it to their own icon set\nand should fall back to a generic icon for an unrecognised name.",
            "nullable": true
          },
          "format": {
            "type": "string",
            "description": "How to render the value: integer, decimal, duration (milliseconds), currency (USD), or score (0-100).",
            "nullable": true
          },
          "aggregation": {
            "type": "string",
            "description": "How buckets combine: \"sum\" for counts, \"average\" for metrics that are already a\nper-bucket average, \"endingBalance\" for a running balance whose range value is the\nlast bucket's, \"distinct\" for a count of distinct things. Only \"sum\" may be folded\nfrom buckets the client already has — for the others, re-query the whole range as a\nsingle bucket instead.",
            "nullable": true
          },
          "supportsSourceSplit": {
            "type": "boolean",
            "description": "False for agency-wide metrics. The query endpoint rejects groupBy/source filters\nand the source resolution for these."
          },
          "dimensions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnalyticsDimensionDto"
            },
            "description": "What this metric can be filtered and segmented by. Build the filter chips from this —\nthe endpoint rejects any dimension not listed, so offering more would surface as a\n400 rather than an ignored filter.",
            "nullable": true
          },
          "minResolution": {
            "type": "string",
            "description": "Finest time bucket this metric can answer, or null for no limit. Contact counts are\ndaily facts, so their finer resolutions must be disabled rather than requested.",
            "nullable": true
          },
          "distinctCount": {
            "type": "boolean",
            "description": "True when the value counts contacts rather than events. Segmenting one of these gives\nseries that sum to more than the unsegmented total — a contact active on two channels\nbelongs to both — which is worth saying in the UI rather than hiding."
          },
          "locked": {
            "type": "boolean",
            "description": "True when this agency cannot query the metric. Analytics add-on metrics are locked\nwithout `HasAnalytics`; rebilled spend is locked off an agency plan. The query\nendpoint rejects a locked metric."
          }
        },
        "additionalProperties": false
      },
      "AnalyticsMissingTimeZoneSource": {
        "required": [
          "sourceId",
          "sourceName"
        ],
        "type": "object",
        "properties": {
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "sourceName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A source whose rows had to be bucketed as UTC because it has no usable zone."
      },
      "AnalyticsQueryFilters": {
        "type": "object",
        "properties": {
          "sourceIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional AgencySource IDs to include.",
            "nullable": true
          },
          "dimensions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DimensionFilter"
            },
            "description": "Optional narrowing by the metric's declared dimensions. Each entry ANDs with the rest.\nA dimension the metric does not declare is a 400 rather than a silent no-op — a chart\nmust never quietly show unfiltered totals under a filter the user set.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AnalyticsQueryPoint": {
        "required": [
          "timestamp",
          "value"
        ],
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "string",
            "description": "Start of the bucket. A UTC instant in utc mode; a local wall-clock value with no\nzone (and therefore no trailing Z) in sourceLocal mode.",
            "format": "date-time"
          },
          "value": {
            "type": "number",
            "description": "Bucket value. Decimal because metrics can be currency, durations or averages;\ncount metrics still come back as whole numbers.",
            "format": "double"
          },
          "group": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Present when groupBy is set, or when resolution is a non-time dimension.\nCarries the dimension's raw value plus a display label under \"<dimension>Label\",\nso the chart legend does not have to know how to render a channel key or a bot id.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AnalyticsQueryRequest": {
        "required": [
          "end",
          "metric",
          "resolution",
          "start"
        ],
        "type": "object",
        "properties": {
          "metric": {
            "type": "string",
            "description": "Metric to query. Call GET /analytics/metrics for the full catalog of valid keys,\nor pass \"formula\" together with Closebot.Api.Controllers.AnalyticsController.AnalyticsQueryRequest.Formula to compute a derived metric.",
            "nullable": true
          },
          "formula": {
            "$ref": "#/components/schemas/AnalyticsFormulaRequest"
          },
          "start": {
            "type": "string",
            "description": "Inclusive start. A UTC instant in utc mode; a source-local wall-clock value in\nsourceLocal mode. Must align to a 15-minute boundary.",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "description": "Exclusive end. A UTC instant in utc mode; a source-local wall-clock value in\nsourceLocal mode. Must align to a 15-minute boundary.",
            "format": "date-time"
          },
          "resolution": {
            "type": "string",
            "description": "Bucket size. Time buckets: 15m, hour, day, week, month (multiples of the 15-minute base).\nWeek buckets start Monday 00:00 of the active time basis.\nNon-time: source (one point per source name over the whole range, not grouped by time),\ntotal (the whole range as one point), hourOfWeek (every bucket folded onto one week of\nday-of-week x hour-of-day cells).",
            "nullable": true
          },
          "groupBy": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional dimension to split the series by — source, channel, bot, persona, or the\nmetric's own detail dimensions. At most one: a chart segments by a single thing, and\nallowing two would multiply the series out past anything readable.",
            "nullable": true
          },
          "timeZone": {
            "type": "string",
            "description": "IANA time zone id (e.g. \"America/Denver\") used by the hourOfWeek fold when\nClosebot.Api.Controllers.AnalyticsController.AnalyticsQueryRequest.TimeBasis is utc, to decide which local weekday and hour each bucket\nbelongs to. Ignored by every other resolution, and ignored entirely in sourceLocal\nmode — that fold reads each row's own source-local timestamp instead. Defaults to UTC.",
            "nullable": true
          },
          "timeBasis": {
            "type": "string",
            "description": "\"utc\" (default) or \"sourceLocal\". See Closebot.Api.Controllers.AnalyticsController.AnalyticsTimeBasis.\nIn sourceLocal mode Closebot.Api.Controllers.AnalyticsController.AnalyticsQueryRequest.Start and Closebot.Api.Controllers.AnalyticsController.AnalyticsQueryRequest.End are read as\nwall-clock values rather than UTC instants, so a month means each source's own\nlocal month.",
            "nullable": true
          },
          "filters": {
            "$ref": "#/components/schemas/AnalyticsQueryFilters"
          }
        },
        "additionalProperties": false
      },
      "AnalyticsQueryResponse": {
        "required": [
          "points"
        ],
        "type": "object",
        "properties": {
          "points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnalyticsQueryPoint"
            },
            "nullable": true
          },
          "sourcesMissingTimeZone": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnalyticsMissingTimeZoneSource"
            },
            "description": "Sources that contributed rows to this result but have no resolvable timezone, so\nwere bucketed as UTC. Populated only in sourceLocal mode; null otherwise.\nLets the chart say which sources need fixing instead of being quietly wrong.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AnalyticsSourceTimeZonesResponse": {
        "required": [
          "timeZones"
        ],
        "type": "object",
        "properties": {
          "defaultTimeZone": {
            "type": "string",
            "description": "The single time zone every source in scope agrees on, or null when they disagree or\nnone is configured. Clients use it to seed a picker, falling back to the browser zone.",
            "nullable": true
          },
          "timeZones": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every distinct non-empty time zone configured on the sources in scope.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AnswerFAQRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "answer": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AnswerMultipleFAQsRequest": {
        "type": "object",
        "properties": {
          "faQs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnswerFAQRequest"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AnsweredFAQFollowUpRequest": {
        "required": [
          "faqId",
          "leadIds"
        ],
        "type": "object",
        "properties": {
          "faqId": {
            "type": "string",
            "description": "The answered FAQ.",
            "nullable": true
          },
          "leadIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The leads to follow with.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ApiKeyDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "AssistantChartDto": {
        "type": "object",
        "properties": {
          "chartId": {
            "type": "string",
            "nullable": true
          },
          "spec": { },
          "gated": {
            "type": "boolean"
          }
        },
        "additionalProperties": false,
        "description": "One chart the assistant drew, as the query that produces it."
      },
      "AssistantMessageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "role": {
            "type": "string",
            "nullable": true
          },
          "authorAccountId": {
            "type": "string",
            "nullable": true
          },
          "body": {
            "type": "string",
            "nullable": true
          },
          "thinkingSummary": {
            "type": "string",
            "nullable": true
          },
          "thinkingMs": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "feedback": {
            "type": "string",
            "nullable": true
          },
          "editedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "turnId": {
            "type": "string",
            "nullable": true
          },
          "stepIndex": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AssistantPlanDto": {
        "type": "object",
        "properties": {
          "turnId": {
            "type": "string",
            "nullable": true
          },
          "steps": { }
        },
        "additionalProperties": false,
        "description": "The steps one turn said it was working through, as they stood when it finished."
      },
      "AssistantSessionDto": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "toolMode": {
            "type": "string",
            "nullable": true
          },
          "alwaysAllowedTools": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastActivityAt": {
            "type": "string",
            "format": "date-time"
          },
          "forkedFromSessionId": {
            "type": "string",
            "nullable": true
          },
          "contexts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContextPillDto"
            },
            "nullable": true
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantMessageDto"
            },
            "nullable": true
          },
          "toolCalls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantToolCallDto"
            },
            "nullable": true
          },
          "charts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantChartDto"
            },
            "nullable": true
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantPlanDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AssistantSessionSummaryDto": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastActivityAt": {
            "type": "string",
            "format": "date-time"
          },
          "messageCount": {
            "type": "integer",
            "format": "int32"
          },
          "forkedFromSessionId": {
            "type": "string",
            "nullable": true
          },
          "pinned": {
            "type": "boolean"
          },
          "contexts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContextPillDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A session as it appears in the history list — no transcript.\n            \nSeparate from Closebot.Api.Controllers.AssistantController.AssistantSessionDto on purpose. The previous per-lead version\nbuilt the full transcript for every row; at agency scope that is a query per session plus\nevery message of every session, to render a list that shows a title and a date."
      },
      "AssistantToolCallDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "toolName": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "isDestructive": {
            "type": "boolean"
          },
          "previewJson": {
            "type": "string",
            "nullable": true
          },
          "resultSummary": {
            "type": "string",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "argumentsJson": {
            "type": "string",
            "nullable": true
          },
          "durationMs": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "AttachSourceInput": {
        "required": [
          "channels"
        ],
        "type": "object",
        "properties": {
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactTag"
            },
            "nullable": true
          },
          "tagFilterConfig": {
            "$ref": "#/components/schemas/TagFilterConfig"
          },
          "channels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "channelRules": {
            "$ref": "#/components/schemas/ChannelRulesConfig"
          },
          "personaNameOverride": {
            "type": "string",
            "nullable": true
          },
          "enabled": {
            "type": "boolean",
            "nullable": true
          },
          "flowVariableValues": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BalanceDto": {
        "required": [
          "balance",
          "currency"
        ],
        "type": "object",
        "properties": {
          "balance": {
            "type": "integer",
            "description": "Balance in smallest unit of currency (cents in USD).",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BilledUsageDto": {
        "type": "object",
        "properties": {
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "responses": {
            "type": "integer",
            "format": "int32"
          },
          "segments": {
            "type": "number",
            "format": "double"
          },
          "libraryBytes": {
            "type": "integer",
            "format": "int64"
          },
          "users": {
            "type": "integer",
            "format": "int32"
          },
          "responseCost": {
            "type": "integer",
            "format": "int64"
          },
          "libraryCost": {
            "type": "integer",
            "format": "int64"
          },
          "userCost": {
            "type": "integer",
            "format": "int64"
          },
          "assistantTurns": {
            "type": "integer",
            "format": "int32"
          },
          "assistantCost": {
            "type": "integer",
            "format": "int64"
          },
          "assistantSegments": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "BillingOptionsDto": {
        "type": "object",
        "properties": {
          "overBillingEnabled": {
            "type": "boolean"
          },
          "usageBillingEnabled": {
            "type": "boolean"
          },
          "autoRefillEnabled": {
            "type": "boolean"
          },
          "topUpAmount": {
            "type": "integer",
            "format": "int64"
          },
          "refillThreshold": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "modifiedAt": {
            "type": "string",
            "nullable": true
          },
          "modifiedBy": {
            "type": "string",
            "nullable": true
          },
          "versions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotVersionDto"
            },
            "nullable": true
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotSourceDto"
            },
            "nullable": true
          },
          "personaIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "personaWeights": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int32"
            },
            "nullable": true
          },
          "favorited": {
            "type": "boolean"
          },
          "locked": {
            "type": "boolean"
          },
          "reschedulingEnabled": {
            "type": "boolean"
          },
          "category": {
            "type": "string",
            "nullable": true
          },
          "folderId": {
            "type": "string",
            "nullable": true
          },
          "followUpActive": {
            "type": "boolean"
          },
          "followUpSequences": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FollowUpSequenceDto"
            },
            "nullable": true
          },
          "smartFollowUp": {
            "type": "boolean"
          },
          "followUpRepeat": {
            "type": "boolean"
          },
          "followUpVarianceMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "followUpExtraPrompt": {
            "type": "string",
            "nullable": true
          },
          "personaSplitTest": {
            "$ref": "#/components/schemas/PersonaSplitTestDto"
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotToolDto"
            },
            "nullable": true
          },
          "followUpStates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FollowUpStateDto"
            },
            "nullable": true
          },
          "availableSplitTestMetrics": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PersonaSplitTestMetricOptionDto"
            },
            "nullable": true
          },
          "builderMode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotInstanceDto": {
        "type": "object",
        "properties": {
          "botId": {
            "type": "string",
            "nullable": true
          },
          "botVersion": {
            "type": "string",
            "nullable": true
          },
          "followUpTimezoneKind": {
            "type": "string",
            "nullable": true
          },
          "followUpTimezone": {
            "type": "string",
            "nullable": true
          },
          "followUpTime": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "isSmartFollowUpTime": {
            "type": "boolean"
          },
          "scheduleRespondTime": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotMetricAction": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "actionId": {
            "type": "string",
            "nullable": true
          },
          "leadId": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "botId": {
            "type": "string",
            "nullable": true
          },
          "nodeId": {
            "type": "integer",
            "format": "int32"
          },
          "frontendNodeId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotMetricActivity": {
        "required": [
          "activity",
          "data"
        ],
        "type": "object",
        "properties": {
          "activity": {
            "type": "string",
            "nullable": true
          },
          "data": {
            "type": "string",
            "nullable": true
          },
          "timeData": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "faviconUrl": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotMetricAttachment": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "The URL of the attachment",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotMetricCostShare": {
        "type": "object",
        "properties": {
          "globalPromptBase": {
            "type": "number",
            "format": "double"
          },
          "nodePrompting": {
            "type": "number",
            "format": "double"
          },
          "toolDescriptions": {
            "type": "number",
            "format": "double"
          },
          "knowledgeBase": {
            "type": "number",
            "format": "double"
          },
          "toolCallResults": {
            "type": "number",
            "format": "double"
          },
          "conversationHistory": {
            "type": "number",
            "format": "double"
          },
          "responseFormat": {
            "type": "number",
            "format": "double"
          },
          "thinking": {
            "type": "number",
            "format": "double"
          },
          "toolCallsEmitted": {
            "type": "number",
            "format": "double"
          },
          "message": {
            "type": "number",
            "format": "double"
          },
          "toolDetailJson": {
            "type": "string",
            "nullable": true
          },
          "version": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "BotMetricLog": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "botId": {
            "type": "string",
            "nullable": true
          },
          "messageId": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "leadId": {
            "type": "string",
            "nullable": true
          },
          "actionId": {
            "type": "string",
            "nullable": true
          },
          "severity": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "prompt": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotMetricPrompt"
            },
            "nullable": true
          },
          "response": {
            "type": "string",
            "nullable": true
          },
          "promptTokens": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "completionTokens": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "provider": {
            "type": "string",
            "nullable": true
          },
          "model": {
            "type": "string",
            "nullable": true
          },
          "purpose": {
            "type": "string",
            "nullable": true
          },
          "body": {
            "type": "string",
            "nullable": true
          },
          "costShare": {
            "$ref": "#/components/schemas/BotMetricCostShare"
          }
        },
        "additionalProperties": false
      },
      "BotMetricMessage": {
        "required": [
          "activities",
          "attachments",
          "direction",
          "fromBot",
          "leadId",
          "message",
          "messageId",
          "sourceId",
          "timestamp"
        ],
        "type": "object",
        "properties": {
          "messageId": {
            "type": "string",
            "description": "The unique ID of the message",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "description": "The ID of the source",
            "nullable": true
          },
          "leadId": {
            "type": "string",
            "description": "The ID of the lead",
            "nullable": true
          },
          "botId": {
            "type": "string",
            "description": "The optional ID of the bot",
            "nullable": true
          },
          "personaId": {
            "type": "string",
            "description": "The optional ID of the persona",
            "nullable": true
          },
          "channel": {
            "type": "string",
            "description": "The optional channel of the message",
            "nullable": true
          },
          "channelAddress": {
            "type": "string",
            "description": "The business's own receiving number or inbox for this message — the address the lead\ncontacted (inbound) or the one we replied from (outbound), raw as the provider sent it.\nThis is the value channel destination rules are evaluated against. Null for channels\nwith no such concept (chat widget, bot testing), for human/external sends, and for\nevery message received before this was captured.",
            "nullable": true
          },
          "fromBot": {
            "type": "boolean",
            "description": "Whether the message was sent from the bot"
          },
          "direction": {
            "type": "string",
            "description": "The direction of the message (inbound or outbound)",
            "nullable": true
          },
          "message": {
            "type": "string",
            "description": "The content of the message",
            "nullable": true
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotMetricAttachment"
            },
            "description": "The list of attachments associated with the message",
            "nullable": true
          },
          "timestamp": {
            "type": "string",
            "description": "The timestamp when the message was sent",
            "format": "date-time"
          },
          "activities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotMetricActivity"
            },
            "description": "The list of activities associated with the message",
            "nullable": true
          },
          "turnSentiment": {
            "type": "integer",
            "description": "Turn Sentiment: the lexicon's reading of this message's own words, an\ninteger 0–100 (higher = more positive). Populated only on inbound lead\nmessages. `50` means no signal; `null` means not yet computed.",
            "format": "int32",
            "nullable": true
          },
          "conversationSentiment": {
            "type": "integer",
            "description": "Conversation Sentiment: the mean of the last 10 Turn Sentiments for this\nlead as of this message, on the same 0–100 scale. `null` where not\nyet computed.",
            "format": "int32",
            "nullable": true
          },
          "responderName": {
            "type": "string",
            "description": "The display name of the human responder (external messages and notes)",
            "nullable": true
          },
          "responderIconUrl": {
            "type": "string",
            "description": "The avatar URL of the human responder (external messages and notes)",
            "nullable": true
          },
          "aiVisible": {
            "type": "boolean",
            "description": "For notes (direction \"note\"): whether the AI can see the note"
          },
          "authorAccountId": {
            "type": "string",
            "description": "For notes (direction \"note\"): the account ID of the note's author.\nNull for notes created before authorship was tracked.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotMetricPrompt": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "nullable": true
          },
          "body": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotNodeGroup": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "order": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "BotNodePropertyCondition": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotPersonaDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotPersonaOverallPerformanceDto": {
        "type": "object",
        "properties": {
          "personaId": {
            "type": "string",
            "nullable": true
          },
          "personaName": {
            "type": "string",
            "nullable": true
          },
          "botId": {
            "type": "string",
            "nullable": true
          },
          "botName": {
            "type": "string",
            "nullable": true
          },
          "splitWeight": {
            "type": "integer",
            "format": "int32"
          },
          "totalInstances": {
            "type": "integer",
            "format": "int32"
          },
          "responseCount": {
            "type": "integer",
            "format": "int32"
          },
          "averageMetric": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "BotPersonaPerformanceDto": {
        "type": "object",
        "properties": {
          "personaId": {
            "type": "string",
            "nullable": true
          },
          "personaName": {
            "type": "string",
            "nullable": true
          },
          "botId": {
            "type": "string",
            "nullable": true
          },
          "botName": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "sourceName": {
            "type": "string",
            "nullable": true
          },
          "splitWeight": {
            "type": "integer",
            "format": "int32"
          },
          "totalInstances": {
            "type": "integer",
            "format": "int32"
          },
          "responseCount": {
            "type": "integer",
            "format": "int32"
          },
          "averageMetric": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "BotPersonaPerformanceResponseDto": {
        "type": "object",
        "properties": {
          "overall": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotPersonaOverallPerformanceDto"
            },
            "nullable": true
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotPersonaPerformanceSourceDto"
            },
            "nullable": true
          },
          "start": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "end": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "splitTestId": {
            "type": "string",
            "nullable": true
          },
          "metric": {
            "type": "string",
            "nullable": true
          },
          "metricLabel": {
            "type": "string",
            "nullable": true
          },
          "metricShortLabel": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotPersonaPerformanceSourceDto": {
        "type": "object",
        "properties": {
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "sourceName": {
            "type": "string",
            "nullable": true
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotPersonaPerformanceDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotPersonaSplitTestPersonaResults": {
        "type": "object",
        "properties": {
          "personaId": {
            "type": "string",
            "nullable": true
          },
          "personaName": {
            "type": "string",
            "nullable": true
          },
          "splitWeight": {
            "type": "integer",
            "format": "int32"
          },
          "totalInstances": {
            "type": "integer",
            "format": "int32"
          },
          "responseCount": {
            "type": "integer",
            "format": "int32"
          },
          "averageMetric": {
            "type": "number",
            "format": "double"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotPersonaSplitTestPersonaSourceResult"
            },
            "nullable": true
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "BotPersonaSplitTestPersonaSourceResult": {
        "type": "object",
        "properties": {
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "sourceName": {
            "type": "string",
            "nullable": true
          },
          "totalInstances": {
            "type": "integer",
            "format": "int32"
          },
          "responseCount": {
            "type": "integer",
            "format": "int32"
          },
          "averageMetric": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "BotSourceAvailabilityDto": {
        "type": "object",
        "properties": {
          "dayOfWeekUtc": {
            "type": "string",
            "nullable": true
          },
          "startTimeUtc": {
            "type": "string",
            "nullable": true
          },
          "duration": {
            "type": "string",
            "nullable": true
          },
          "channel": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotSourceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "type": "string",
            "nullable": true
          },
          "key": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactTag"
            },
            "nullable": true
          },
          "tagFilterConfig": {
            "$ref": "#/components/schemas/TagFilterConfig"
          },
          "channelList": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "channelRules": {
            "$ref": "#/components/schemas/ChannelRulesConfig"
          },
          "personaNameOverride": {
            "type": "string",
            "nullable": true
          },
          "enabled": {
            "type": "boolean"
          },
          "flowVariableValues": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotSourceMcpAuthDto": {
        "type": "object",
        "properties": {
          "botId": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "serverUrl": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "connected": {
            "type": "boolean"
          },
          "setupReady": {
            "type": "boolean"
          },
          "clientId": {
            "type": "string",
            "nullable": true
          },
          "authorizeEndpoint": {
            "type": "string",
            "nullable": true
          },
          "codeChallenge": {
            "type": "string",
            "nullable": true
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotSourceMcpAuthInput": {
        "type": "object",
        "properties": {
          "serverUrl": {
            "type": "string",
            "nullable": true
          },
          "authorizationCode": {
            "type": "string",
            "nullable": true
          },
          "redirectUri": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotTemplateDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "level": {
            "type": "string",
            "nullable": true
          },
          "industry": {
            "type": "string",
            "nullable": true
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "videoUrl": {
            "type": "string",
            "nullable": true
          },
          "previewUrl": {
            "type": "string",
            "nullable": true
          },
          "tier": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotTestingRollbackInput": {
        "required": [
          "messageId"
        ],
        "type": "object",
        "properties": {
          "messageId": {
            "type": "string",
            "description": "The ID of the first message to delete. All subsequent messages will also be deleted.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotTestingRollbackOutput": {
        "required": [
          "deletedActionIds",
          "deletedMessageIds"
        ],
        "type": "object",
        "properties": {
          "deletedMessageIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The IDs of the deleted messages",
            "nullable": true
          },
          "deletedActionIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The IDs of the deleted actions",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotToolDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "enabled": {
            "type": "boolean"
          },
          "options": {
            "$ref": "#/components/schemas/BotToolOptions"
          }
        },
        "additionalProperties": false
      },
      "BotToolOptions": {
        "type": "object",
        "additionalProperties": false
      },
      "BotVariableDto": {
        "required": [
          "id",
          "name",
          "value"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotVariableUpdateInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BotVersionDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "published": {
            "type": "boolean"
          },
          "modifiedAt": {
            "type": "string",
            "format": "date-time"
          },
          "modifiedBy": {
            "type": "string",
            "nullable": true
          },
          "builderMode": {
            "type": "string",
            "description": "Which builder authored this version: `\"Simple\"` or `\"Advanced\"`. Restoring the\nversion puts the flow back into that builder.",
            "nullable": true,
            "readOnly": true
          },
          "label": {
            "type": "string",
            "description": "The version as users see it -- `\"0.0.7s\"` for a simplified version, `\"0.0.7a\"`\nfor an advanced one. Closebot.Api.Controllers.BotController.BotVersionDto.Version stays the bare `x.y.z`, which is what\nevery lookup and comparison uses.",
            "nullable": true,
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "CapturedWebhookEventDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time"
          },
          "headersJson": {
            "type": "string",
            "nullable": true
          },
          "bodyJson": {
            "type": "string",
            "nullable": true
          },
          "truncated": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "CapturedWebhookEventsResult": {
        "type": "object",
        "properties": {
          "listening": {
            "type": "boolean"
          },
          "listenUntil": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CapturedWebhookEventDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ChannelRule": {
        "type": "object",
        "properties": {
          "operator": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ChannelRuleSet": {
        "type": "object",
        "properties": {
          "channel": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChannelRule"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ChannelRulesConfig": {
        "type": "object",
        "properties": {
          "channels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChannelRuleSet"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ContactTag": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "approveDeny": {
            "type": "boolean"
          },
          "id": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ContextPillDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "kind": {
            "type": "string",
            "nullable": true
          },
          "refId": {
            "type": "string",
            "nullable": true
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "addedAutomatically": {
            "type": "boolean"
          },
          "iconHint": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateApiKeyInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateApiKeyOutput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "key": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "CreateBotInput": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the new bot",
            "nullable": true
          },
          "templateId": {
            "type": "string",
            "description": "The template ID to use to create the new bot",
            "nullable": true
          },
          "importKdl": {
            "type": "string",
            "description": "The KDL template to import into the new bot",
            "nullable": true
          },
          "folderId": {
            "type": "string",
            "description": "The folder ID to place the new bot in",
            "nullable": true
          },
          "category": {
            "type": "string",
            "description": "The category of the new bot",
            "nullable": true
          },
          "conversationReason": {
            "type": "string",
            "description": "Optional conversation reason (why the conversation is happening) to pre-fill into the bot's business variables.",
            "nullable": true
          },
          "businessInformation": {
            "type": "string",
            "description": "Optional business information to pre-fill into the bot's business variables.\nWhen a template already contains business information, this value is appended.",
            "nullable": true
          },
          "personaIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional default persona. When omitted, the agency default is used.\nMust contain exactly one persona when provided.",
            "nullable": true
          },
          "simpleMode": {
            "type": "boolean",
            "description": "Open the new bot in the simplified builder.\n\nOnly meaningful alongside Closebot.Api.Controllers.BotController.CreateBotInput.TemplateId: the template's flow is collapsed\naround its first Agent node, exactly as switching an existing flow to Simple would do,\nso the account gets the template's prompt without a canvas the simple view cannot\nrender. A from-scratch bot is already Simple and ignores this."
          }
        },
        "additionalProperties": false
      },
      "CreateDashboardInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "data": {
            "nullable": true
          },
          "reportId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateEmailDomainDto": {
        "required": [
          "domain"
        ],
        "type": "object",
        "properties": {
          "domain": {
            "type": "string",
            "nullable": true
          },
          "fromLocalPart": {
            "type": "string",
            "nullable": true
          },
          "fromName": {
            "type": "string",
            "nullable": true
          },
          "logoUrl": {
            "type": "string",
            "nullable": true
          },
          "appDomain": {
            "type": "string",
            "description": "Whitelabel app domain, so links in this agency's email stay on their\nown domain instead of sending the reader to app.closebot.com.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateNoteInputDto": {
        "required": [
          "aiVisible",
          "body"
        ],
        "type": "object",
        "properties": {
          "body": {
            "type": "string",
            "nullable": true
          },
          "aiVisible": {
            "type": "boolean",
            "description": "Whether the AI agent can see this note in its conversation context."
          },
          "mentionedAccountIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Account IDs of users @-mentioned in the body. Team members are\nalways allowed; clients only if they have access to the lead's\nsource. Anything else is dropped silently.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreatePersonaInput": {
        "required": [
          "aiProviderPreferences",
          "personaName"
        ],
        "type": "object",
        "properties": {
          "personaName": {
            "type": "string",
            "description": "The name of the persona",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "The description of the persona",
            "nullable": true
          },
          "voiceStyles": {
            "type": "string",
            "description": "The voice styles of the persona",
            "nullable": true
          },
          "howToRespond": {
            "type": "string",
            "description": "The how to respond of the persona",
            "nullable": true
          },
          "typoPercent": {
            "type": "integer",
            "description": "The typo percent of the persona",
            "format": "int32"
          },
          "breakupLargeMessagePercent": {
            "type": "integer",
            "description": "The breakup large message percent of the persona",
            "format": "int32"
          },
          "responseTime": {
            "type": "string",
            "description": "The response time of the persona",
            "nullable": true
          },
          "responseDelay": {
            "type": "integer",
            "description": "The response delay of the persona",
            "format": "int32"
          },
          "aiProviderPreferences": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The AI provider preferences of the persona",
            "nullable": true
          },
          "color": {
            "type": "string",
            "description": "The color of the persona",
            "nullable": true
          },
          "imageData": {
            "type": "string",
            "description": "The image data of the persona",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateRefillDto": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateReportInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateScheduledMessageInputDto": {
        "required": [
          "kind",
          "sendAt"
        ],
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "description": "\"manual\" sends Body verbatim; \"ai\" generates the message\n            at send time with the conversation's last-responding agent.",
            "nullable": true
          },
          "body": {
            "type": "string",
            "description": "Required for manual messages; ignored for AI messages.",
            "nullable": true
          },
          "sendAt": {
            "type": "string",
            "format": "date-time"
          },
          "cancelOnReply": {
            "type": "boolean",
            "description": "Cancel this message if the contact replies before it\n            sends. Defaults to true for AI messages, false for manual.",
            "nullable": true
          },
          "channel": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateSmartFAQRequest": {
        "required": [
          "answer",
          "question",
          "sourceId"
        ],
        "type": "object",
        "properties": {
          "sourceId": {
            "type": "string",
            "description": "The source ID of the FAQ",
            "nullable": true
          },
          "question": {
            "type": "string",
            "description": "The question of the FAQ",
            "nullable": true
          },
          "answer": {
            "type": "string",
            "description": "The answer of the FAQ",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateSourceChannelInput": {
        "required": [
          "provider"
        ],
        "type": "object",
        "properties": {
          "friendlyName": {
            "type": "string",
            "nullable": true
          },
          "provider": {
            "type": "string",
            "nullable": true
          },
          "uniqueId": {
            "type": "string",
            "description": "Required for vendor channels; generated for Custom Channels.",
            "nullable": true
          },
          "authToken": {
            "type": "string",
            "description": "Vendor credential; generated as the access token for Custom Channels.",
            "nullable": true
          },
          "refreshToken": {
            "type": "string",
            "nullable": true
          },
          "expiration": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "callbackUri": {
            "type": "string",
            "description": "Custom Channels only: the legacy callback that receives bot events.",
            "nullable": true
          },
          "projectId": {
            "type": "string",
            "description": "Sinch project id.",
            "nullable": true
          },
          "appId": {
            "type": "string",
            "description": "Sinch Conversation API app id.",
            "nullable": true
          },
          "region": {
            "type": "string",
            "description": "Sinch region: us, eu, or br.",
            "nullable": true
          },
          "conversationChannel": {
            "type": "string",
            "description": "Sinch conversation channel, such as SMS or WHATSAPP.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DashboardDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "ownerAccountId": {
            "type": "string",
            "nullable": true
          },
          "reportId": {
            "type": "string",
            "nullable": true
          },
          "data": { }
        },
        "additionalProperties": false
      },
      "DataTypeInfo": {
        "type": "object",
        "properties": {
          "dataTypeName": {
            "type": "string",
            "nullable": true
          },
          "properties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PropertyInfo"
            },
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DimensionFilter": {
        "required": [
          "dimension",
          "operator"
        ],
        "type": "object",
        "properties": {
          "dimension": {
            "type": "string",
            "nullable": true
          },
          "operator": {
            "type": "string",
            "nullable": true
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DnsRecordDto": {
        "type": "object",
        "properties": {
          "record": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "string",
            "nullable": true
          },
          "ttl": {
            "type": "string",
            "nullable": true
          },
          "priority": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DynamicOutputHandleInfo": {
        "type": "object",
        "properties": {
          "linkedProperty": {
            "type": "string",
            "nullable": true
          },
          "labelPropertyName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "EmailCategoryDto": {
        "required": [
          "allowedCadences",
          "cadence",
          "defaultCadence",
          "internalCadence",
          "key",
          "webhookCadences"
        ],
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "nullable": true
          },
          "cadence": {
            "type": "string",
            "description": "Resolved cadence: \"off\", \"daily\", \"instant\", \"weekly\" or \"monthly\".",
            "nullable": true
          },
          "defaultCadence": {
            "type": "string",
            "description": "What this category falls back to when nobody has chosen. Sent so the client can\noffer \"turn this back on\" without keeping its own copy of the defaults, which would\ndrift the moment one is retuned here.",
            "nullable": true
          },
          "allowedCadences": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Cadences this category accepts. A single-entry list means the UI must render a\nstatic label rather than a select — a receipt is not something to opt out of.",
            "nullable": true
          },
          "usingAgencyDefault": {
            "type": "boolean",
            "description": "True when this row is inheriting the agency owner's choice."
          },
          "webhookCadences": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Endpoints this category reaches, as endpoint id to cadence. Lets one notification\nroll up weekly by email while hitting a webhook instantly.",
            "nullable": true
          },
          "internalCadence": {
            "type": "string",
            "description": "How the in-app bell treats this category: \"off\" or a cadence. Per member, like\nemail.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "EmailDomainDto": {
        "required": [
          "domain",
          "fromAddress",
          "records",
          "status"
        ],
        "type": "object",
        "properties": {
          "domain": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "description": "\"pending\", \"verified\", or \"failed\".",
            "nullable": true
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DnsRecordDto"
            },
            "description": "DNS entries the agency must add. Empty once verified.",
            "nullable": true
          },
          "fromAddress": {
            "type": "string",
            "description": "The address mail will send from, e.g. notifications@mail.acme.com.",
            "nullable": true
          },
          "fromName": {
            "type": "string",
            "nullable": true
          },
          "logoUrl": {
            "type": "string",
            "nullable": true
          },
          "appDomain": {
            "type": "string",
            "description": "Whitelabel app domain used for links inside this agency's emails.",
            "nullable": true
          },
          "verifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "EmailPreferencesDto": {
        "required": [
          "categories",
          "webhookEndpoints"
        ],
        "type": "object",
        "properties": {
          "usingAgencyDefaults": {
            "type": "boolean",
            "description": "True when the user has not chosen for themselves and is therefore\nfollowing the agency owner's settings."
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailCategoryDto"
            },
            "description": "One row per email category, in the order the settings UI lists them. Carries the\nresolved cadence and the options the UI may offer, so the client never has to hold\nits own copy of which categories can be rolled up.",
            "nullable": true
          },
          "maxEmailsPerDay": {
            "type": "integer",
            "description": "Ceiling on emails per day. Overflow is folded into the next digest.",
            "format": "int32"
          },
          "autoDowngradedAt": {
            "type": "string",
            "description": "Set when categories were moved off Instant automatically because this user was\nbeing flooded, so the UI can explain itself rather than looking broken.",
            "format": "date-time",
            "nullable": true
          },
          "autoDowngradedCategories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "webhookEndpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEndpointDto"
            },
            "description": "Every webhook endpoint the agency has saved, so the page can offer them without a\nsecond request. Agency-wide, unlike the per-member cadences above.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "EmptyTrashResponse": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "integer",
            "description": "How many job flows were permanently removed.",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "EndPersonaSplitTestErrorResponse": {
        "required": [
          "message"
        ],
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ExportBotResponse": {
        "required": [
          "id",
          "kdl",
          "version"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The bot ID",
            "nullable": true
          },
          "kdl": {
            "type": "string",
            "description": "The KDL for the bot",
            "nullable": true
          },
          "version": {
            "type": "string",
            "description": "The version of the bot",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ExternalConnectInput": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "nullable": true
          },
          "redirectUrl": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ExternalConnectableItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "path": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ExternalConnectionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "externalAccountId": {
            "type": "string",
            "nullable": true
          },
          "externalName": {
            "type": "string",
            "nullable": true
          },
          "connected": {
            "type": "boolean"
          },
          "expiration": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "ExternalResourceItemSyncDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "externalItemId": {
            "type": "string",
            "nullable": true
          },
          "externalParentItemId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "path": {
            "type": "string",
            "nullable": true
          },
          "mimeType": {
            "type": "string",
            "nullable": true
          },
          "size": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "externalModifiedTime": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "lastSeenAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastSyncedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ExternalResourceSyncDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "connectionId": {
            "type": "string",
            "nullable": true
          },
          "libraryDocumentId": {
            "type": "string",
            "nullable": true
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileSourceDto"
            },
            "nullable": true
          },
          "folderId": {
            "type": "string",
            "nullable": true
          },
          "folderName": {
            "type": "string",
            "nullable": true
          },
          "recursive": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "lastSyncStartedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastSyncCompletedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastSuccessfulSyncAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "syncedFiles": {
            "type": "integer",
            "format": "int32"
          },
          "unsupportedFiles": {
            "type": "integer",
            "format": "int32"
          },
          "errorFiles": {
            "type": "integer",
            "format": "int32"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalResourceItemSyncDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ExternalSyncInput": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string",
            "nullable": true
          },
          "recursive": {
            "type": "boolean",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FileDto": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string",
            "nullable": true
          },
          "fileName": {
            "type": "string",
            "nullable": true
          },
          "lastModified": {
            "type": "string",
            "format": "date-time"
          },
          "fileType": {
            "type": "string",
            "nullable": true
          },
          "fileStatus": {
            "type": "string",
            "nullable": true
          },
          "fileSize": {
            "type": "integer",
            "format": "int64"
          },
          "estimatedFileSize": {
            "type": "integer",
            "format": "int64"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileSourceDto"
            },
            "nullable": true
          },
          "accountId": {
            "type": "string",
            "nullable": true
          },
          "uri": {
            "type": "string",
            "nullable": true
          },
          "lastUse": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "uses": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "faviconUrl": {
            "type": "string",
            "nullable": true
          },
          "externalProvider": {
            "type": "string",
            "nullable": true
          },
          "externalLibraryResourceSyncId": {
            "type": "string",
            "nullable": true
          },
          "externalItemId": {
            "type": "string",
            "nullable": true
          },
          "externalResourceId": {
            "type": "string",
            "nullable": true
          },
          "externalResourceName": {
            "type": "string",
            "nullable": true
          },
          "externalResourceType": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FilePreviewChunkDto": {
        "type": "object",
        "properties": {
          "chunkIndex": {
            "type": "integer",
            "format": "int32"
          },
          "content": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FilePreviewDto": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string",
            "nullable": true
          },
          "fileName": {
            "type": "string",
            "nullable": true
          },
          "fileType": {
            "type": "string",
            "nullable": true
          },
          "fileStatus": {
            "type": "string",
            "nullable": true
          },
          "fileSize": {
            "type": "integer",
            "format": "int64"
          },
          "lastModified": {
            "type": "string",
            "format": "date-time"
          },
          "previewSource": {
            "type": "string",
            "nullable": true
          },
          "content": {
            "type": "string",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "chunks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FilePreviewChunkDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FileSourceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FollowUpSequenceDto": {
        "type": "object",
        "properties": {
          "order": {
            "type": "integer",
            "format": "int32"
          },
          "duration": {
            "type": "integer",
            "format": "int32"
          },
          "unit": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FollowUpStateDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "isDefault": {
            "type": "boolean"
          },
          "sequences": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FollowUpSequenceDto"
            },
            "nullable": true
          },
          "repeatFinal": {
            "type": "boolean"
          },
          "extraPrompt": {
            "type": "string",
            "nullable": true
          },
          "order": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "FollowUpStateInputDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "isDefault": {
            "type": "boolean"
          },
          "sequences": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FollowUpSequenceDto"
            },
            "nullable": true
          },
          "repeatFinal": {
            "type": "boolean"
          },
          "extraPrompt": {
            "type": "string",
            "nullable": true
          },
          "order": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "ForkSessionInputDto": {
        "required": [
          "fromMessageId"
        ],
        "type": "object",
        "properties": {
          "fromMessageId": {
            "type": "string",
            "description": "The message to branch at. Everything up to and including it is carried across;\neverything after it is left behind in the original.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetBoardResponse": {
        "required": [
          "around",
          "cohort",
          "eligibility",
          "industryAvailable",
          "period",
          "top"
        ],
        "type": "object",
        "properties": {
          "period": {
            "$ref": "#/components/schemas/LeaderboardPeriodDto"
          },
          "cohort": {
            "$ref": "#/components/schemas/LeaderboardCohortDto"
          },
          "industryAvailable": {
            "type": "boolean",
            "description": "Whether a same-industry board exists for this subject, metric and period — and so\nwhether that comparison can be chosen.\n            \nDeliberately a boolean. Answering \"is there one\" is the whole of what a client needs;\nanswering \"which one\" is the disclosure this endpoint will not make."
          },
          "industryLockReason": {
            "type": "string",
            "description": "Why the comparison cannot be chosen, when it cannot. Null when it can.\n            \n`\"needsVolume\"` — the source has not been seen enough for us to classify it yet,\nand Closebot.Api.Controllers.LeaderboardController.GetBoardResponse.IndustryMessagesCurrent counts toward\nClosebot.Api.Controllers.LeaderboardController.GetBoardResponse.IndustryMessagesRequired.\n            \n`\"notYet\"` — anything else, and deliberately incurious. A source can be past the\nthreshold but waiting on the next batch, examined and found unclassifiable, classified\ntoo tentatively to publish, or classified fine but in a vertical with too few ranked\nparticipants to build a board from. The client is told the comparison is unavailable\nand not invited to guess which — the last of those cases in particular would hint at\nhow many participants a vertical has.",
            "nullable": true
          },
          "industryMessagesCurrent": {
            "type": "integer",
            "description": "Inbound messages this source has, when Closebot.Api.Controllers.LeaderboardController.GetBoardResponse.IndustryLockReason is\n`\"needsVolume\"`. The caller's own figure for their own source.",
            "format": "int64",
            "nullable": true
          },
          "industryMessagesRequired": {
            "type": "integer",
            "description": "Inbound messages needed before a first classification is attempted, when\nClosebot.Api.Controllers.LeaderboardController.GetBoardResponse.IndustryLockReason is `\"needsVolume\"`.",
            "format": "int64",
            "nullable": true
          },
          "top": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeaderboardEntryDto"
            },
            "description": "The leading entities, for the podium and the top-of-board view.",
            "nullable": true
          },
          "around": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeaderboardEntryDto"
            },
            "description": "The window around the caller's best-placed entity. Empty when the caller is not on\nthis board. This, not Closebot.Api.Controllers.LeaderboardController.GetBoardResponse.Top, is the view most users should land on — the\nnext rank up has to look reachable.",
            "nullable": true
          },
          "me": {
            "$ref": "#/components/schemas/LeaderboardStandingDto"
          },
          "eligibility": {
            "$ref": "#/components/schemas/LeaderboardEligibilityDto"
          }
        },
        "additionalProperties": false
      },
      "GetPersonaPerformanceErrorResponse": {
        "required": [
          "message"
        ],
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetProfileResponse": {
        "required": [
          "axes",
          "entity",
          "mySources",
          "mySourcesTruncated"
        ],
        "type": "object",
        "properties": {
          "entity": {
            "$ref": "#/components/schemas/LeaderboardProfileEntityDto"
          },
          "axes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeaderboardAxisDto"
            },
            "description": "One entry per headline metric, in display order. Drives the radar.",
            "nullable": true
          },
          "mySources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeaderboardMySourceDto"
            },
            "description": "The caller's own sources. Feeds the subject picker and the your-sources comparison,\nand never contains another tenant's data.",
            "nullable": true
          },
          "mySourcesTruncated": {
            "type": "boolean",
            "description": "True when Closebot.Api.Controllers.LeaderboardController.GetProfileResponse.MySources was capped."
          }
        },
        "additionalProperties": false
      },
      "HierarchyInput": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The new name of the folder",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "InstanceUpdateDto": {
        "type": "object",
        "properties": {
          "followUpTime": {
            "type": "string",
            "description": "The follow up time of the instance",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "Invite": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "nullable": true
          },
          "role": {
            "type": "string",
            "nullable": true
          },
          "sourceIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "InviteUserInput": {
        "type": "object",
        "properties": {
          "invites": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invite"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "JsonNode": {
        "type": "object",
        "properties": {
          "options": {
            "$ref": "#/components/schemas/JsonNodeOptions"
          },
          "parent": {
            "$ref": "#/components/schemas/JsonNode"
          },
          "root": {
            "$ref": "#/components/schemas/JsonNode"
          }
        },
        "additionalProperties": false
      },
      "JsonNodeOptions": {
        "type": "object",
        "properties": {
          "propertyNameCaseInsensitive": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "JsonValue": {
        "type": "object",
        "properties": {
          "options": {
            "$ref": "#/components/schemas/JsonNodeOptions"
          },
          "parent": {
            "$ref": "#/components/schemas/JsonNode"
          },
          "root": {
            "$ref": "#/components/schemas/JsonNode"
          }
        },
        "additionalProperties": false
      },
      "LeadAiToggleDto": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "applicable": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LeadAiToggleUpdateDto": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "LeadDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "contactId": {
            "type": "string",
            "nullable": true
          },
          "lastMessageTime": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastMessage": {
            "type": "string",
            "nullable": true
          },
          "lastMessageDirection": {
            "type": "string",
            "nullable": true
          },
          "lastMessageBotId": {
            "type": "string",
            "nullable": true
          },
          "lastMessageChannel": {
            "type": "string",
            "nullable": true
          },
          "mostRecentFailureReason": {
            "type": "string",
            "nullable": true
          },
          "mimicSourceId": {
            "type": "string",
            "nullable": true
          },
          "starred": {
            "type": "boolean"
          },
          "unread": {
            "type": "boolean"
          },
          "score": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "source": {
            "$ref": "#/components/schemas/LeadSourceDto"
          },
          "wontRespondUntil": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadFieldDto"
            },
            "nullable": true
          },
          "instances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotInstanceDto"
            },
            "nullable": true
          },
          "lastMessageIsNote": {
            "type": "boolean"
          },
          "mentionedMe": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "LeadFieldDto": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "string",
            "nullable": true
          },
          "aiProduced": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "LeadFieldUpdateDto": {
        "required": [
          "field",
          "value"
        ],
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LeadHistoryEventDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "eventType": {
            "type": "string",
            "nullable": true
          },
          "visitedAt": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "nullable": true
          },
          "path": {
            "type": "string",
            "nullable": true
          },
          "domain": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "triggerType": {
            "type": "string",
            "nullable": true
          },
          "actionKey": {
            "type": "string",
            "nullable": true
          },
          "points": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One entry in a lead's history timeline. The feed is heterogeneous —\n`EventType` discriminates — so the page-visit fields and the\nscoring fields are each populated only for their own kind. Page-visit\nfield names are unchanged from when this endpoint returned visits\nalone, including `VisitedAt`, which doubles as the timeline's\nsort key for every kind."
      },
      "LeadListResultDto": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int32"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadDto"
            },
            "nullable": true
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "starredTotal": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "mentionsTotal": {
            "type": "integer",
            "description": "Count of leads with a note @-mentioning the caller, scope-wide.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Paginated lead list plus a scope-wide starred count, so the sidebar's\nPriority badge can show a true total instead of a loaded-page proxy."
      },
      "LeadSourceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LeadTopicDto": {
        "type": "object",
        "properties": {
          "topicId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "slug": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One conversation topic carried by a lead.\n            \nName and slug only. `LeadTopic.StartedOn` and `LeadTopic.Sentiment`\nare deliberately not projected: both are per-<em>conversation</em> values\ncopied onto every one of a lead's rows, so they are identical across the\nwhole list and carry no per-topic information."
      },
      "LeadTypingInputDto": {
        "required": [
          "active"
        ],
        "type": "object",
        "properties": {
          "active": {
            "type": "boolean"
          },
          "channel": {
            "type": "string",
            "nullable": true
          },
          "clientTypingId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LeadUpdateDto": {
        "required": [
          "fields"
        ],
        "type": "object",
        "properties": {
          "starred": {
            "type": "boolean",
            "nullable": true
          },
          "unread": {
            "type": "boolean",
            "nullable": true
          },
          "wontRespondUntil": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadFieldUpdateDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LeaderboardAxisDto": {
        "required": [
          "format",
          "higherIsBetter",
          "label",
          "metric"
        ],
        "type": "object",
        "properties": {
          "metric": {
            "type": "string",
            "nullable": true
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "format": {
            "type": "string",
            "nullable": true
          },
          "higherIsBetter": {
            "type": "boolean"
          },
          "current": {
            "$ref": "#/components/schemas/LeaderboardAxisPointDto"
          },
          "previous": {
            "$ref": "#/components/schemas/LeaderboardAxisPointDto"
          }
        },
        "additionalProperties": false,
        "description": "One radar axis: a metric, plus where the subject sits on it now and last month."
      },
      "LeaderboardAxisPointDto": {
        "required": [
          "percentile",
          "value"
        ],
        "type": "object",
        "properties": {
          "percentile": {
            "type": "number",
            "description": "\"Top N%\" within the cohort.",
            "format": "double"
          },
          "value": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "The caller's own standing on one metric in one period.\n            \nA percentile and a value, never a rank or a cohort size. The radar derives its axis from\n`100 - percentile`; publishing an exact placement alongside the percentile would be\ntwo equations in `(rank, N)` and would solve for the population."
      },
      "LeaderboardCellDto": {
        "required": [
          "value"
        ],
        "type": "object",
        "properties": {
          "value": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "One entity's standing on one metric, as carried inside a board row.\n            \nThe value only. Rank, percentile and participant count all previously rode along here on\nevery row of every request — roughly five hundred (rank, percentile) pairs per call, which\nis more than enough to pin the population by intersection."
      },
      "LeaderboardCohortDto": {
        "required": [
          "kind"
        ],
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "description": "\"global\" or \"industry\".",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The peer group a rank is relative to."
      },
      "LeaderboardEligibilityDto": {
        "required": [
          "current",
          "isEligible",
          "minimum"
        ],
        "type": "object",
        "properties": {
          "isEligible": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "description": "Machine-readable cause when not eligible: \"belowVolumeFloor\", \"noIndustryLabel\",\n\"notComputedYet\". Null when eligible.",
            "nullable": true
          },
          "minimum": {
            "type": "integer",
            "description": "Unique leads needed this period to be ranked.",
            "format": "int32"
          },
          "current": {
            "type": "number",
            "description": "Unique leads the caller has so far this period.",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "Why the caller is or is not on a board."
      },
      "LeaderboardEntryDto": {
        "required": [
          "cells",
          "direction",
          "displayName",
          "isMine",
          "value"
        ],
        "type": "object",
        "properties": {
          "rank": {
            "type": "integer",
            "description": "1-10 in `top`. Null everywhere else.",
            "format": "int32",
            "nullable": true
          },
          "direction": {
            "type": "string",
            "description": "Which way this entity moved since last month, without the magnitude — \"up\", \"down\",\n\"flat\" or \"new\".\n            \nThe magnitude is withheld because it is a rank in disguise: a row at rank 3 that moved\nup 136 was at rank 139 last month, which is a lower bound on last month's population.\nThe caller's own movement keeps its number, because it pairs with no rank.",
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "description": "The owning account's username, or \"Anonymous\". Together with\nClosebot.Api.Controllers.LeaderboardController.LeaderboardEntryDto.ImageUrl this is the identity a row carries for anyone outside the\nowning agency; real source and agency names still never cross a tenant boundary.",
            "nullable": true
          },
          "imageUrl": {
            "type": "string",
            "description": "The owning account's Clerk profile photo, for the avatar the board renders in place of\na rank numeral.\n            \nNull on rows that fall back to Closebot.Api.Controllers.LeaderboardController.AnonymousDisplayName — an account that\nnever set a username has not opted into a public identity, and attaching its owner's\nface would undo that fallback — and null whenever the Clerk lookup fails, which the\nclient renders as initials.",
            "nullable": true
          },
          "value": {
            "type": "number",
            "format": "double"
          },
          "isMine": {
            "type": "boolean",
            "description": "True when this row belongs to the requesting agency."
          },
          "entityId": {
            "type": "string",
            "description": "Which of the caller's own entities this row is. Populated under the same rule as\nClosebot.Api.Controllers.LeaderboardController.LeaderboardEntryDto.OwnName — only when Closebot.Api.Controllers.LeaderboardController.LeaderboardEntryDto.IsMine is true — and it is the caller's\nown id, so it says nothing about anyone else.\n            \nNeeded because Closebot.Api.Controllers.LeaderboardController.LeaderboardEntryDto.IsMine is agency-level: several of the caller's sources\ncan share one window, so \"this row is mine\" does not identify the one they asked about.",
            "nullable": true
          },
          "ownName": {
            "type": "string",
            "description": "The entity's real name — the source name at source scope, the agency name at agency\nscope. Populated only when Closebot.Api.Controllers.LeaderboardController.LeaderboardEntryDto.IsMine is true: a source name is usually the\nclient's business name, and neither it nor an agency name may cross a tenant\nboundary. Everyone else has only Closebot.Api.Controllers.LeaderboardController.LeaderboardEntryDto.DisplayName.",
            "nullable": true
          },
          "cells": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/LeaderboardCellDto"
            },
            "description": "This entity's standing on every headline metric, keyed by metric key. A key is absent\nwhen the entity is not ranked for that metric — which is a real state (\"not enough\ndata to place them\"), distinct from placing last, and is rendered as a gap rather\nthan a zero.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One placed entity on a board.\n            \nCarries a rank only inside `top`, where the rank is 1-10 by construction and reveals\nnothing about the population. It never carries a percentile: a rank and a percentile for\nthe same entity are two equations in `(rank, N)` and solve for the cohort size."
      },
      "LeaderboardMetricDto": {
        "required": [
          "description",
          "format",
          "higherIsBetter",
          "isHeadline",
          "isSelectable",
          "key",
          "label",
          "supportsSourceScope"
        ],
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Wire key to pass as `metric` on GET /leaderboard/board.",
            "nullable": true
          },
          "label": {
            "type": "string",
            "description": "Display name.",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "What the metric counts, and anything it deliberately excludes.",
            "nullable": true
          },
          "guidance": {
            "type": "string",
            "description": "One sentence on how to move this metric, for the board's headline figure.\n            \nNull outside the headline set and the board-only metrics, and clients must render\nnothing rather than an empty line — widening `Headline` before its copy is written\nshould degrade to silence, not to a stray label.",
            "nullable": true
          },
          "format": {
            "type": "string",
            "description": "How to render the value: integer, decimal, duration (milliseconds), currency (USD),\nscore (0-100), percent, hours (minutes, shown as hours with one decimal) or minutes.",
            "nullable": true
          },
          "higherIsBetter": {
            "type": "boolean",
            "description": "False when the board ranks ascending — cost, latency and error metrics, where #1\nmeans least rather than most. Clients should say so next to the metric; a user who\nassumes \"more is better\" will read an AI-errors board exactly backwards."
          },
          "supportsSourceScope": {
            "type": "boolean",
            "description": "False for agency-wide metrics. Requesting `scope=source` for one of these is a 400."
          },
          "isHeadline": {
            "type": "boolean",
            "description": "True for the metrics the board actually surfaces — the radar's axes and the table's\ncolumns, in the order they appear here. Everything else is still ranked and stored,\njust not shown."
          },
          "isSelectable": {
            "type": "boolean",
            "description": "True for the metrics a client offers to rank by: the headline and the board-only\nmetrics (Time Saved). A board-only metric has no radar axis and no table cells, and\nnever counts toward the Standing Score, which reads Closebot.Api.Controllers.LeaderboardController.LeaderboardMetricDto.IsHeadline only."
          }
        },
        "additionalProperties": false
      },
      "LeaderboardMySourceDto": {
        "required": [
          "id",
          "name"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One of the caller's own sources — enough to populate the subject picker, and no more.\n            \nPreviously carried a full set of headline standings including cohort sizes. Nothing\nconsumes them, so they are gone rather than left as an unused leak."
      },
      "LeaderboardPeriodDto": {
        "required": [
          "key",
          "start"
        ],
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Wire value to pass back as `period`: \"current\" or \"previous\".",
            "nullable": true
          },
          "start": {
            "type": "string",
            "description": "First instant of the period, UTC.",
            "format": "date-time"
          }
        },
        "additionalProperties": false,
        "description": "The calendar month a board covers.\n            \nStart and key only. The period type was always \"month\", the end is always one month past\nthe start, and the client formats its own month label in the user's locale — a server-side\n\"September 2026\" is English for everybody."
      },
      "LeaderboardProfileEntityDto": {
        "required": [
          "label"
        ],
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "What the axes describe, for the subject heading above the radar.\n            \nThe label only. The id is whatever the caller passed as `entityId`, and the kind is\nwhatever they passed as `scope`; neither told the client anything it did not already\nknow."
      },
      "LeaderboardStandingDto": {
        "required": [
          "entityId",
          "percentile",
          "value"
        ],
        "type": "object",
        "properties": {
          "percentile": {
            "type": "number",
            "format": "double"
          },
          "value": {
            "type": "number",
            "format": "double"
          },
          "entityId": {
            "type": "string",
            "description": "Source id at source scope, agency id at agency scope.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Where the caller sits on this board.\n            \nA percentile and a movement, never an absolute rank — a rank alongside the percentile\nsolves for the cohort size, and a rank on its own still tells the worst-placed tenant\nroughly how many there are."
      },
      "ListHierarchyResult": {
        "required": [
          "bots",
          "children",
          "id",
          "name",
          "personas"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The ID of the folder",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "The name of the folder",
            "nullable": true
          },
          "bots": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The list of bots in the folder. Excludes trashed bots — see the filtered includes on\nthe queries below.",
            "nullable": true
          },
          "personas": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The list of personas in the folder. Excludes trashed personas.",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The list of children folders",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ListLeadDto": {
        "type": "object",
        "properties": {
          "leads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadDto"
            },
            "nullable": true
          },
          "total": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "LiveDemoCreateDto": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The friendly-name of the live demo.",
            "nullable": true
          },
          "mimicSourceId": {
            "type": "string",
            "description": "The source ID to mimic when conversing.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Whether or not this demo is active."
          }
        },
        "additionalProperties": false
      },
      "LiveDemoDto": {
        "required": [
          "active",
          "key",
          "name",
          "organizationId",
          "sourceVariables"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "key": {
            "type": "string",
            "nullable": true
          },
          "organizationId": {
            "type": "string",
            "nullable": true
          },
          "active": {
            "type": "boolean"
          },
          "mimicSourceId": {
            "type": "string",
            "nullable": true
          },
          "sourceVariables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotVariableDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LiveDemoMessageInput": {
        "required": [
          "message"
        ],
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "The message to send",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LiveDemoSessionDto": {
        "required": [
          "key",
          "sessionLeadId"
        ],
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The key of the live demo used to create this session",
            "nullable": true
          },
          "sessionLeadId": {
            "type": "string",
            "description": "The lead ID of the session",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MessageFeedbackRequest": {
        "type": "object",
        "properties": {
          "messageId": {
            "type": "string",
            "nullable": true
          },
          "leadId": {
            "type": "string",
            "nullable": true
          },
          "reasons": {
            "type": "string",
            "nullable": true
          },
          "liked": {
            "type": "boolean",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MessageFeedbackResponse": {
        "required": [
          "feedbackMessageIds"
        ],
        "type": "object",
        "properties": {
          "feedbackMessageIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The list of message IDs with feedback",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MessageLikesResponse": {
        "required": [
          "likedMessageIds"
        ],
        "type": "object",
        "properties": {
          "likedMessageIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The list of message IDs with likes",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MessageReason": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "NodeInfo": {
        "type": "object",
        "properties": {
          "className": {
            "type": "string",
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "group": {
            "type": "string",
            "nullable": true
          },
          "properties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PropertyInfo"
            },
            "nullable": true
          },
          "outputs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutputInfo"
            },
            "nullable": true
          },
          "outputHandles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutputHandleInfo"
            },
            "nullable": true
          },
          "dynamicHandles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DynamicOutputHandleInfo"
            },
            "nullable": true
          },
          "hasInputHandle": {
            "type": "boolean"
          },
          "hasDynamicVariables": {
            "type": "boolean"
          },
          "helpUrl": {
            "type": "string",
            "nullable": true
          },
          "requiresPaid": {
            "type": "boolean"
          },
          "order": {
            "type": "integer",
            "format": "int32"
          },
          "hidden": {
            "type": "boolean"
          },
          "beta": {
            "type": "boolean"
          },
          "legacy": {
            "type": "boolean"
          },
          "learnResources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NodeLearnResourceItem"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "NodeInformation": {
        "type": "object",
        "properties": {
          "dataTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataTypeInfo"
            },
            "nullable": true
          },
          "atomicNodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NodeInfo"
            },
            "nullable": true
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotNodeGroup"
            },
            "nullable": true
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ToolInfo"
            },
            "nullable": true
          },
          "learnResources": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/NodeLearnResourceItem"
              }
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "NodeLearnResourceItem": {
        "type": "object",
        "properties": {
          "resourceType": {
            "type": "string",
            "nullable": true
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "target": {
            "type": "string",
            "nullable": true
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "NoteResultDto": {
        "required": [
          "aiVisible",
          "noteId"
        ],
        "type": "object",
        "properties": {
          "noteId": {
            "type": "string",
            "nullable": true
          },
          "aiVisible": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "NotificationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "kind": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "body": {
            "type": "string",
            "nullable": true
          },
          "viewed": {
            "type": "boolean"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "metadata": {
            "$ref": "#/components/schemas/AgencyNotificationMetadata"
          }
        },
        "additionalProperties": false
      },
      "NotificationUpdateDto": {
        "type": "object",
        "properties": {
          "viewed": {
            "type": "boolean",
            "description": "Whether the notification has been viewed"
          }
        },
        "additionalProperties": false
      },
      "OutputHandleInfo": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OutputInfo": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PersonaDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "agencyId": {
            "type": "string",
            "nullable": true
          },
          "personaName": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true
          },
          "imageUri": {
            "type": "string",
            "nullable": true
          },
          "voiceStyles": {
            "type": "string",
            "nullable": true
          },
          "howToRespond": {
            "type": "string",
            "nullable": true
          },
          "typoPercent": {
            "type": "integer",
            "format": "int32"
          },
          "breakupLargeMessagePercent": {
            "type": "integer",
            "format": "int32"
          },
          "responseTime": {
            "type": "string",
            "nullable": true
          },
          "responseDelay": {
            "type": "integer",
            "format": "int32"
          },
          "modifiedAt": {
            "type": "string",
            "nullable": true
          },
          "modifiedBy": {
            "type": "string",
            "nullable": true
          },
          "aiProviderPreferences": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "folderId": {
            "type": "string",
            "nullable": true
          },
          "botIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "bots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotPersonaDto"
            },
            "nullable": true
          },
          "favorited": {
            "type": "boolean"
          },
          "default": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "PersonaSplitTestDto": {
        "type": "object",
        "properties": {
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "personas": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PersonaSplitTestPersonaDto"
            },
            "nullable": true
          },
          "id": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "metric": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PersonaSplitTestMetricOptionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "shortLabel": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PersonaSplitTestPageDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PersonaSplitTestDto"
            },
            "nullable": true
          },
          "total": {
            "type": "integer",
            "format": "int32"
          },
          "hasMore": {
            "type": "boolean"
          }
        },
        "additionalProperties": false,
        "description": "One page of split-test history. An envelope rather than a bare array so\nthe client knows when to stop asking; Closebot.Api.Controllers.BotController.PersonaSplitTestPageDto.Total is what the\nhistory tray shows in its collapsed bar."
      },
      "PersonaSplitTestPersonaDto": {
        "type": "object",
        "properties": {
          "personaId": {
            "type": "string",
            "nullable": true
          },
          "weight": {
            "type": "integer",
            "format": "int32"
          },
          "order": {
            "type": "integer",
            "format": "int32"
          },
          "results": {
            "$ref": "#/components/schemas/BotPersonaSplitTestPersonaResults"
          }
        },
        "additionalProperties": false
      },
      "PillCandidateDto": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "nullable": true
          },
          "refId": {
            "type": "string",
            "nullable": true
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "iconHint": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PreviewImportInput": {
        "required": [
          "kdl"
        ],
        "type": "object",
        "properties": {
          "kdl": {
            "type": "string",
            "description": "The raw KDL content to preview",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PreviewImportResponse": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "error": {
            "type": "string",
            "nullable": true
          },
          "nodeCount": {
            "type": "integer",
            "format": "int32"
          },
          "nodeTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "hasConversationReason": {
            "type": "boolean"
          },
          "hasBusinessInformation": {
            "type": "boolean"
          },
          "sourceVariableCount": {
            "type": "integer",
            "format": "int32"
          },
          "customToolCount": {
            "type": "integer",
            "format": "int32"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": { }
      },
      "PropertyInfo": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "enumValues": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "nullable": true
          },
          "defaultValue": {
            "type": "string",
            "nullable": true
          },
          "group": {
            "type": "string",
            "nullable": true
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotNodePropertyCondition"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PublishBotResponse": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "$ref": "#/components/schemas/JsonValue"
          }
        },
        "additionalProperties": false
      },
      "ReBillingDto": {
        "type": "object",
        "properties": {
          "reBillingConfigured": {
            "type": "boolean"
          },
          "responseUnitCost": {
            "type": "string",
            "nullable": true
          },
          "storageUnitCost": {
            "type": "string",
            "nullable": true
          },
          "userUnitCost": {
            "type": "string",
            "nullable": true
          },
          "tokenMultiplier": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ReBillingUpdateInput": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "nullable": true
          },
          "responseCost": {
            "type": "string",
            "nullable": true
          },
          "storageCost": {
            "type": "string",
            "nullable": true
          },
          "userCost": {
            "type": "string",
            "nullable": true
          },
          "tokenMultiplier": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "RejectToolCallInputDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Fed back to the assistant as the tool result so it can adapt.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ReplaceSourceResponse": {
        "type": "object",
        "properties": {
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "botsMoved": {
            "type": "integer",
            "format": "int32"
          },
          "botsMerged": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "ReportDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "ownerAccountId": {
            "type": "string",
            "nullable": true
          },
          "ownerName": {
            "type": "string",
            "nullable": true
          },
          "ownerImageUrl": {
            "type": "string",
            "nullable": true
          },
          "isMine": {
            "type": "boolean"
          },
          "canEdit": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ReportShareDto": {
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ReportSharesInput": {
        "type": "object",
        "properties": {
          "accountIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "RestoreVersionResponse": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "description": "The new version written by the restore (x.y.z).",
            "nullable": true
          },
          "builderMode": {
            "type": "string",
            "description": "`\"Simple\"` or `\"Advanced\"`, taken from the restored version.",
            "nullable": true
          },
          "label": {
            "type": "string",
            "description": "The new version as users see it, for example `\"0.0.9s\"`.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SaveBotError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "nullable": true
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable discriminator; prefer this over matching on Error.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Error body returned when a write is rejected for a simplified job flow."
      },
      "SaveBotInput": {
        "type": "object",
        "properties": {
          "botSteps": { },
          "layoutOnly": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "SaveBotResponse": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "nullable": true
          },
          "invalidPaths": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "message": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SaveWebhookContactFetchInput": {
        "type": "object",
        "properties": {
          "template": {
            "$ref": "#/components/schemas/WebhookOutboundTemplateDto"
          },
          "fieldPaths": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SaveWebhookEndpointDto": {
        "required": [
          "url"
        ],
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "nullable": true
          },
          "label": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SaveWebhookInboundInput": {
        "type": "object",
        "properties": {
          "mapping": {
            "$ref": "#/components/schemas/WebhookInboundMappingDto"
          },
          "filterKey": {
            "$ref": "#/components/schemas/WebhookFilterKeyDto"
          },
          "requireAccessToken": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "SaveWebhookOutboundInput": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "nullable": true
          },
          "webhookCallbackUri": {
            "type": "string",
            "nullable": true
          },
          "sendMessageTemplate": {
            "$ref": "#/components/schemas/WebhookOutboundTemplateDto"
          },
          "setFieldTemplate": {
            "$ref": "#/components/schemas/WebhookOutboundTemplateDto"
          },
          "externalApiKey": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ScheduledMessageDto": {
        "required": [
          "cancelOnReply",
          "createdAt",
          "createdByAccountId",
          "id",
          "kind",
          "leadId",
          "sendAt",
          "status"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "leadId": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "kind": {
            "type": "string",
            "nullable": true
          },
          "body": {
            "type": "string",
            "nullable": true
          },
          "channel": {
            "type": "string",
            "nullable": true
          },
          "botId": {
            "type": "string",
            "nullable": true
          },
          "sendAt": {
            "type": "string",
            "format": "date-time"
          },
          "cancelOnReply": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "statusReason": {
            "type": "string",
            "nullable": true
          },
          "createdByAccountId": {
            "type": "string",
            "nullable": true
          },
          "createdByName": {
            "type": "string",
            "nullable": true
          },
          "createdByIconUrl": {
            "type": "string",
            "nullable": true
          },
          "sentMessageId": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "SearchLeadResultDto": {
        "required": [
          "leads",
          "total"
        ],
        "type": "object",
        "properties": {
          "leads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadDto"
            },
            "nullable": true
          },
          "total": {
            "type": "integer",
            "format": "int32"
          },
          "starredTotal": {
            "type": "integer",
            "description": "Count of starred leads across the whole (unpaginated) baseline\nscope (before StarredOnly/MentionedOnly narrowing). Only populated\non the source-only fast path — the sidebar Priority count reads it.",
            "format": "int32",
            "nullable": true
          },
          "mentionsTotal": {
            "type": "integer",
            "description": "Count of leads with a note @-mentioning the caller across the\nbaseline scope. Only populated on the source-only fast path — the\nsidebar Mentions count reads it.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SearchQueryInput": {
        "required": [
          "botIds",
          "channels",
          "personaIds",
          "sourceIds"
        ],
        "type": "object",
        "properties": {
          "totalOnly": {
            "type": "boolean",
            "nullable": true
          },
          "sourceOnlyFast": {
            "type": "boolean",
            "nullable": true
          },
          "offset": {
            "type": "integer",
            "description": "The offset of the search results.",
            "format": "int32",
            "nullable": true
          },
          "count": {
            "type": "integer",
            "description": "The count of the search results.",
            "format": "int32",
            "nullable": true
          },
          "search": {
            "type": "string",
            "description": "The search query.",
            "nullable": true
          },
          "sourceIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The source IDs.",
            "nullable": true
          },
          "channels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The channel IDs.",
            "nullable": true
          },
          "botIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The bot IDs.",
            "nullable": true
          },
          "personaIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The persona IDs.",
            "nullable": true
          },
          "topicIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Conversation topic IDs. A lead matches if it carries any of them.\n            \nOptional rather than required, unlike the lists above: every existing caller\npredates topics, and making it required would break all of them.",
            "nullable": true
          },
          "minimumResponses": {
            "type": "integer",
            "description": "The minimum number of responses.",
            "format": "int32",
            "nullable": true
          },
          "lastMessageDirection": {
            "type": "string",
            "description": "The last message direction.",
            "nullable": true
          },
          "followUpScheduled": {
            "type": "boolean",
            "description": "Whether the follow up is scheduled.",
            "nullable": true
          },
          "starredOnly": {
            "type": "boolean",
            "description": "Restrict results to starred leads (the sidebar Priority tab).",
            "nullable": true
          },
          "mentionedOnly": {
            "type": "boolean",
            "description": "Restrict results to leads with a note that @-mentions the caller\n(the sidebar Mentions tab).",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SendMessageInputDto": {
        "required": [
          "body"
        ],
        "type": "object",
        "properties": {
          "body": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SendMessageResultDto": {
        "required": [
          "messageId"
        ],
        "type": "object",
        "properties": {
          "messageId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SetBuilderModeInput": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "description": "`\"Simple\"` or `\"Advanced\"`, case-insensitive.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SetBuilderModeResponse": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "nullable": true
          },
          "version": {
            "type": "string",
            "nullable": true
          },
          "botSteps": { }
        },
        "additionalProperties": false
      },
      "SetCategoryWebhooksDto": {
        "required": [
          "assignments"
        ],
        "type": "object",
        "properties": {
          "assignments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookAssignmentDto"
            },
            "description": "The complete set of endpoint-to-cadence assignments for this category. Sent whole\nrather than as add/remove operations so the result cannot drift from what the user\nis looking at.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SharePreviewResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The shared bot's ID.",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "Its name.",
            "nullable": true
          },
          "personaName": {
            "type": "string",
            "description": "The attached persona's name, or null when it has none.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SmartFAQDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "agencyId": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "question": {
            "type": "string",
            "nullable": true
          },
          "answer": {
            "type": "string",
            "nullable": true
          },
          "leadIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "state": {
            "$ref": "#/components/schemas/AgencySourceFAQState"
          }
        },
        "additionalProperties": false
      },
      "SourceAvailabilityDto": {
        "type": "object",
        "properties": {
          "dayOfWeekUtc": {
            "type": "string",
            "nullable": true
          },
          "startTimeUtc": {
            "type": "string",
            "nullable": true
          },
          "duration": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SourceBotDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "botName": {
            "type": "string",
            "nullable": true
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactTag"
            },
            "nullable": true
          },
          "tagFilterConfig": {
            "$ref": "#/components/schemas/TagFilterConfig"
          },
          "channels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "channelRules": {
            "$ref": "#/components/schemas/ChannelRulesConfig"
          },
          "personaNameOverride": {
            "type": "string",
            "nullable": true
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "SourceCalendarDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SourceChannelDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "string",
            "nullable": true
          },
          "source": {
            "type": "string",
            "nullable": true
          },
          "filterType": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SourceDoNotRespondWindowDto": {
        "type": "object",
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "SourceDto": {
        "type": "object",
        "properties": {
          "agencyId": {
            "type": "string",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "type": "string",
            "nullable": true
          },
          "key": {
            "type": "string",
            "nullable": true
          },
          "accessToken": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "connected": {
            "type": "boolean"
          },
          "autoShutoff": {
            "type": "boolean"
          },
          "gracefulGoodbye": {
            "type": "boolean"
          },
          "bots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceBotDto"
            },
            "nullable": true
          },
          "accountsWithAccess": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "isAvailabilityContactTimezone": {
            "type": "boolean"
          },
          "respondWindows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceAvailabilityDto"
            },
            "nullable": true
          },
          "doNotRespondWindows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceDoNotRespondWindowDto"
            },
            "nullable": true
          },
          "botRespondWindows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotSourceAvailabilityDto"
            },
            "nullable": true
          },
          "isBotRespondWindowsQuietHours": {
            "type": "boolean"
          },
          "summarizeAttachments": {
            "type": "boolean"
          },
          "respondToReactions": {
            "type": "boolean"
          },
          "markConversationAsUnread": {
            "type": "boolean"
          },
          "webhookCallback": {
            "type": "string",
            "nullable": true
          },
          "scriptInstalled": {
            "type": "boolean"
          },
          "scriptLastSeenAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "scriptLastSeenDomain": {
            "type": "string",
            "nullable": true
          },
          "scriptLastSeenEndpoint": {
            "type": "string",
            "nullable": true
          },
          "scriptDomainAllowList": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "wallet": {
            "$ref": "#/components/schemas/SourceWalletDto"
          },
          "hubSpotOwnerId": {
            "type": "string",
            "nullable": true
          },
          "timezone": {
            "type": "string",
            "nullable": true
          },
          "topicsEnabled": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "SourceDtoPaginated": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int32"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceDto"
            },
            "nullable": true
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "SourceFieldCollectionDto": {
        "type": "object",
        "properties": {
          "contact": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceFieldDto"
            },
            "nullable": true
          },
          "location": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceFieldDto"
            },
            "nullable": true
          },
          "customValue": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceFieldDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SourceFieldDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "fieldKey": {
            "type": "string",
            "nullable": true
          },
          "dataType": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SourceOwnerDto": {
        "type": "object",
        "properties": {
          "ownerId": {
            "type": "string",
            "nullable": true
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SourceTagDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SourceWalletDto": {
        "type": "object",
        "properties": {
          "reBilling": {
            "type": "boolean"
          },
          "autoRefill": {
            "type": "boolean"
          },
          "topUpAmount": {
            "type": "integer",
            "format": "int32"
          },
          "refillThreshold": {
            "type": "integer",
            "format": "int32"
          },
          "stripeCustomerId": {
            "type": "string",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "responseUnitCostOverride": {
            "type": "string",
            "nullable": true
          },
          "storageUnitCostOverride": {
            "type": "string",
            "nullable": true
          },
          "userUnitCostOverride": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TagFilterConfig": {
        "type": "object",
        "properties": {
          "operator": {
            "type": "string",
            "nullable": true
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagFilterGroup"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TagFilterGroup": {
        "type": "object",
        "properties": {
          "operator": {
            "type": "string",
            "nullable": true
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagFilterRule"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TagFilterRule": {
        "type": "object",
        "properties": {
          "tagName": {
            "type": "string",
            "nullable": true
          },
          "tagId": {
            "type": "string",
            "nullable": true
          },
          "condition": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TestSession": {
        "required": [
          "leadId",
          "sourceId"
        ],
        "type": "object",
        "properties": {
          "leadId": {
            "type": "string",
            "description": "The lead ID of the test session",
            "nullable": true
          },
          "sourceId": {
            "type": "string",
            "description": "The source ID of the test session",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TestSessionMessageInput": {
        "required": [
          "leadId",
          "message"
        ],
        "type": "object",
        "properties": {
          "leadId": {
            "type": "string",
            "description": "The lead ID",
            "nullable": true
          },
          "message": {
            "type": "string",
            "description": "The message to send",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TestWebhookOutboundResult": {
        "type": "object",
        "properties": {
          "renderedMethod": {
            "type": "string",
            "nullable": true
          },
          "renderedUrl": {
            "type": "string",
            "nullable": true
          },
          "renderedHeaders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookTemplateHeaderDto"
            },
            "nullable": true
          },
          "renderedBody": {
            "type": "string",
            "nullable": true
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "success": {
            "type": "boolean"
          },
          "statusCode": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "responseBody": {
            "type": "string",
            "nullable": true
          },
          "error": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ToolInfo": {
        "type": "object",
        "properties": {
          "className": {
            "type": "string",
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "properties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PropertyInfo"
            },
            "nullable": true
          },
          "helpUrl": {
            "type": "string",
            "nullable": true
          },
          "hidden": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ToolInputDto": {
        "required": [
          "enabled",
          "type"
        ],
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "The type of the tool",
            "nullable": true
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether the tool is enabled"
          },
          "options": {
            "description": "The options for the tool"
          }
        },
        "additionalProperties": false
      },
      "TopicOptionsRequest": {
        "type": "object",
        "properties": {
          "filters": {
            "$ref": "#/components/schemas/AnalyticsQueryFilters"
          }
        },
        "additionalProperties": false
      },
      "TopicOptionsResponse": {
        "required": [
          "topics"
        ],
        "type": "object",
        "properties": {
          "topics": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TopicOptionsTopic"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TopicOptionsTopic": {
        "required": [
          "conversationCount",
          "name",
          "slug",
          "topicId"
        ],
        "type": "object",
        "properties": {
          "topicId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "slug": {
            "type": "string",
            "nullable": true
          },
          "conversationCount": {
            "type": "integer",
            "description": "Distinct conversations carrying this topic within the requested scope. Defines the\nordering the caller relies on — a dropdown has no other ranking, and the topic\nsomeone wants is almost always the biggest one.",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "TopicsQueryRequest": {
        "required": [
          "end",
          "start"
        ],
        "type": "object",
        "properties": {
          "start": {
            "type": "string",
            "description": "Inclusive UTC start. Unlike /analytics/query this is day-grained, so no 15-minute alignment.",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "description": "Inclusive UTC end.",
            "format": "date-time"
          },
          "limit": {
            "type": "integer",
            "description": "Largest topics first; the rest are dropped. Capped at 50.",
            "format": "int32",
            "nullable": true
          },
          "filters": {
            "$ref": "#/components/schemas/AnalyticsQueryFilters"
          }
        },
        "additionalProperties": false
      },
      "TopicsQueryResponse": {
        "required": [
          "analyzedConversations",
          "pendingConversations",
          "sentimentCoverage",
          "topics"
        ],
        "type": "object",
        "properties": {
          "topics": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TopicsTopic"
            },
            "nullable": true
          },
          "analyzedConversations": {
            "type": "integer",
            "description": "Distinct conversations with at least one topic in range.",
            "format": "int32"
          },
          "pendingConversations": {
            "type": "integer",
            "description": "Conversations on topic-enabled sources that have never been classified, agency-wide.\n            \nDeliberately <em>not</em> scoped to the requested range. A range-scoped backlog would\nneed each unanalysed conversation's start date, which means MIN(Message.Time) per lead\n— the scan of the Messages table that this feature's whole design avoids. An agency-wide\nnumber is cheap, and the UI must label it as such rather than implying a percentage.",
            "format": "int32"
          },
          "sentimentCoverage": {
            "type": "number",
            "description": "Share of Closebot.Api.Controllers.AnalyticsController.TopicsQueryResponse.AnalyzedConversations carrying a sentiment reading, 0-1.\nBelow 1 means some sources have Sentiment switched off.",
            "format": "double"
          },
          "oldestAnalyzedOn": {
            "type": "string",
            "description": "Earliest conversation start date with any topic, agency-wide. Lets the UI say\n\"topics from 3 Mar\" so the forward-only cutover reads as a cutover and not a data gap.",
            "format": "date",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TopicsSeriesPoint": {
        "required": [
          "count",
          "date"
        ],
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "The day conversations in this bucket <em>started</em>. See TopicsTopic.",
            "format": "date"
          },
          "count": {
            "type": "integer",
            "format": "int32"
          },
          "avgSentiment": {
            "type": "number",
            "description": "Null when no conversation in this bucket carried a sentiment reading.",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TopicsTopic": {
        "required": [
          "conversationCount",
          "name",
          "sentimentCount",
          "series",
          "slug",
          "topicId"
        ],
        "type": "object",
        "properties": {
          "topicId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "slug": {
            "type": "string",
            "nullable": true
          },
          "conversationCount": {
            "type": "integer",
            "description": "Conversations carrying this topic in range. Drives treemap rectangle area.",
            "format": "int32"
          },
          "avgSentiment": {
            "type": "number",
            "description": "Mean 0-100 sentiment over the conversations that have a reading. Drives the colour axis.\nNull when none do — the caller must render that as \"no data\", never as neutral.",
            "format": "double",
            "nullable": true
          },
          "sentimentCount": {
            "type": "integer",
            "description": "How many conversations the average is built from. Exposed so the UI can visually\ndiscount a rectangle coloured by three readings against one coloured by three hundred.",
            "format": "int32"
          },
          "series": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TopicsSeriesPoint"
            },
            "description": "Daily buckets across the requested range. Sparse: days with no conversations are omitted.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TransactionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "receiptUrl": {
            "type": "string",
            "nullable": true
          },
          "usage": {
            "$ref": "#/components/schemas/BilledUsageDto"
          }
        },
        "additionalProperties": false
      },
      "TransactionDtoPaginated": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int32"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TransactionDto"
            },
            "nullable": true
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "UpdateBillingConfigInput": {
        "type": "object",
        "properties": {
          "overBillingEnabled": {
            "type": "boolean",
            "nullable": true
          },
          "autoRefillEnabled": {
            "type": "boolean",
            "nullable": true
          },
          "topUpAmount": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "refillThreshold": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateBotErrorResponse": {
        "required": [
          "message"
        ],
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateBotInput": {
        "type": "object",
        "properties": {
          "favorite": {
            "type": "boolean",
            "description": "Whether the bot is favorited",
            "nullable": true
          },
          "trash": {
            "type": "boolean",
            "description": "Whether the bot is trashed",
            "nullable": true
          },
          "locked": {
            "type": "boolean",
            "description": "Whether the bot is locked",
            "nullable": true
          },
          "rescheduling": {
            "type": "boolean",
            "description": "Whether the bot has conversation rescheduling enabled",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "The name of the bot",
            "nullable": true
          },
          "folderId": {
            "type": "string",
            "description": "The folder ID of the bot",
            "nullable": true
          },
          "category": {
            "type": "string",
            "description": "The category of the bot",
            "nullable": true
          },
          "followUpActive": {
            "type": "boolean",
            "description": "Whether the bot does follow-ups",
            "nullable": true
          },
          "followUpSequences": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FollowUpSequenceDto"
            },
            "description": "The follow-up sequences of the bot",
            "nullable": true
          },
          "smartFollowUp": {
            "type": "boolean",
            "description": "Whether the bot does smart follow-ups",
            "nullable": true
          },
          "followUpRepeat": {
            "type": "boolean",
            "description": "Whether the bot repeats the last follow-up sequence",
            "nullable": true
          },
          "followUpVarianceMinutes": {
            "type": "integer",
            "description": "The variance minutes for the follow-ups",
            "format": "int32",
            "nullable": true
          },
          "followUpExtraPrompt": {
            "type": "string",
            "description": "The extra prompt for the follow-ups",
            "nullable": true
          },
          "followUpStates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FollowUpStateInputDto"
            },
            "description": "The follow-up states (multi-cadence) for the bot",
            "nullable": true
          },
          "personaIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The bot's default persona. Split-test personas are configured separately.",
            "nullable": true
          },
          "personaWeights": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int32"
            },
            "description": "Legacy default persona weight input. Defaults are always saved as 100%.",
            "nullable": true
          },
          "personaSplitTest": {
            "$ref": "#/components/schemas/PersonaSplitTestDto"
          }
        },
        "additionalProperties": false
      },
      "UpdateDashboardInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "data": {
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateEmailPreferencesDto": {
        "type": "object",
        "properties": {
          "categories": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Category key to cadence. Only the keys present are written, so the UI can send one\nchanged row rather than the whole set and a category left out keeps inheriting.",
            "nullable": true
          },
          "maxEmailsPerDay": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "internalCategories": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Category key to cadence for the in-app bell. Only the keys sent are written.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateNoteInputDto": {
        "type": "object",
        "properties": {
          "body": {
            "type": "string",
            "nullable": true
          },
          "aiVisible": {
            "type": "boolean",
            "nullable": true
          },
          "mentionedAccountIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Full replacement list of mentioned account IDs. Null leaves\nmentions unchanged; only newly added accounts are notified.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdatePersonaInput": {
        "type": "object",
        "properties": {
          "personaName": {
            "type": "string",
            "description": "The name of the persona",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "The description of the persona",
            "nullable": true
          },
          "voiceStyles": {
            "type": "string",
            "description": "The voice styles of the persona",
            "nullable": true
          },
          "howToRespond": {
            "type": "string",
            "description": "The how to respond of the persona",
            "nullable": true
          },
          "typoPercent": {
            "type": "integer",
            "description": "The typo percent of the persona",
            "format": "int32",
            "nullable": true
          },
          "breakupLargeMessagePercent": {
            "type": "integer",
            "description": "The breakup large message percent of the persona",
            "format": "int32",
            "nullable": true
          },
          "responseTime": {
            "type": "string",
            "description": "The response time of the persona",
            "nullable": true
          },
          "responseDelay": {
            "type": "integer",
            "description": "The response delay of the persona",
            "format": "int32",
            "nullable": true
          },
          "aiProviderPreferences": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The AI provider preferences of the persona",
            "nullable": true
          },
          "folderId": {
            "type": "string",
            "description": "The folder ID of the persona",
            "nullable": true
          },
          "favorited": {
            "type": "boolean",
            "description": "Whether the persona is favorited",
            "nullable": true
          },
          "trash": {
            "type": "boolean",
            "description": "Whether the persona is trashed",
            "nullable": true
          },
          "default": {
            "type": "boolean",
            "description": "Whether the persona is default",
            "nullable": true
          },
          "color": {
            "type": "string",
            "description": "The color of the persona",
            "nullable": true
          },
          "imageData": {
            "type": "string",
            "description": "The image data of the persona",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateReportInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateScheduledMessageInputDto": {
        "type": "object",
        "properties": {
          "sendAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "body": {
            "type": "string",
            "description": "Manual messages only; AI messages have no stored body.",
            "nullable": true
          },
          "cancelOnReply": {
            "type": "boolean",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateSessionDto": {
        "required": [
          "sessionId"
        ],
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateSessionInput": {
        "type": "object",
        "properties": {
          "mimicSourceId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateSourceChannelInput": {
        "type": "object",
        "properties": {
          "friendlyName": {
            "type": "string",
            "nullable": true
          },
          "provider": {
            "type": "string",
            "nullable": true
          },
          "uniqueId": {
            "type": "string",
            "nullable": true
          },
          "authToken": {
            "type": "string",
            "nullable": true
          },
          "refreshToken": {
            "type": "string",
            "nullable": true
          },
          "expiration": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "callbackUri": {
            "type": "string",
            "description": "Custom Channels only: the legacy callback; empty clears it.",
            "nullable": true
          },
          "projectId": {
            "type": "string",
            "description": "Sinch project id. Omitted on update keeps the stored value.",
            "nullable": true
          },
          "appId": {
            "type": "string",
            "description": "Sinch Conversation API app id. Omitted on update keeps the stored value.",
            "nullable": true
          },
          "region": {
            "type": "string",
            "description": "Sinch region: us, eu, or br. Omitted on update keeps the stored value.",
            "nullable": true
          },
          "conversationChannel": {
            "type": "string",
            "description": "Sinch conversation channel. Omitted on update keeps the stored value.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateSourceInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "autoShutoff": {
            "type": "boolean",
            "nullable": true
          },
          "gracefulGoodbye": {
            "type": "boolean",
            "nullable": true
          },
          "isAvailabilityContactTimezone": {
            "type": "boolean",
            "nullable": true
          },
          "botRespondWindows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotSourceAvailabilityDto"
            },
            "nullable": true
          },
          "isBotRespondWindowsQuietHours": {
            "type": "boolean",
            "nullable": true
          },
          "respondWindows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceAvailabilityDto"
            },
            "nullable": true
          },
          "doNotRespondWindows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceDoNotRespondWindowDto"
            },
            "nullable": true
          },
          "summarizeAttachments": {
            "type": "boolean",
            "nullable": true
          },
          "respondToReactions": {
            "type": "boolean",
            "nullable": true
          },
          "markConversationsAsUnread": {
            "type": "boolean",
            "nullable": true
          },
          "topicsEnabled": {
            "type": "boolean",
            "nullable": true
          },
          "wallet": {
            "$ref": "#/components/schemas/UpdateSourceWalletInput"
          },
          "accountsWithAccess": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "webhookCallback": {
            "type": "string",
            "nullable": true
          },
          "scriptDomainAllowList": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "hubSpotOwnerId": {
            "type": "string",
            "nullable": true
          },
          "timezone": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateSourceWalletInput": {
        "type": "object",
        "properties": {
          "reBilling": {
            "type": "boolean",
            "nullable": true
          },
          "autoRefill": {
            "type": "boolean",
            "nullable": true
          },
          "topUpAmount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "refillThreshold": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "responseUnitCostOverride": {
            "type": "string",
            "nullable": true
          },
          "storageUnitCostOverride": {
            "type": "string",
            "nullable": true
          },
          "userUnitCostOverride": {
            "type": "string",
            "nullable": true
          },
          "stripeCustomerId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateVersionInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the bot version",
            "nullable": true
          },
          "importKdl": {
            "type": "string",
            "description": "The KDL import for the bot version",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UploadWebscrapeToSourceInput": {
        "type": "object",
        "properties": {
          "scrapeUrl": {
            "type": "string",
            "nullable": true
          },
          "maxBreadth": {
            "type": "integer",
            "format": "int32"
          },
          "maxDepth": {
            "type": "integer",
            "format": "int32"
          },
          "sourceId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WebhookAssignmentDto": {
        "required": [
          "cadence",
          "endpointId"
        ],
        "type": "object",
        "properties": {
          "endpointId": {
            "type": "string",
            "nullable": true
          },
          "cadence": {
            "type": "string",
            "description": "\"monthly\", \"weekly\", \"daily\" or \"instant\".",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WebhookEndpointDto": {
        "required": [
          "categories",
          "id",
          "label",
          "url"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "url": {
            "type": "string",
            "nullable": true
          },
          "label": {
            "type": "string",
            "description": "What the user named it, or the URL's host when they did not.",
            "nullable": true
          },
          "categories": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "What this endpoint receives, as category key to cadence. A category absent from the\nmap is not sent to this endpoint at all.",
            "nullable": true
          },
          "createdByName": {
            "type": "string",
            "description": "Who saved it, for the shared pool. Null for ones carried over from the\n            old single-webhook setting, which predate having a creator.",
            "nullable": true
          },
          "createdByYou": {
            "type": "boolean",
            "description": "True when the caller added this one themselves."
          },
          "canDelete": {
            "type": "boolean",
            "description": "Whether the caller may delete it. Computed here rather than re-derived in the UI,\nso the button and the endpoint cannot disagree about the rule."
          }
        },
        "additionalProperties": false
      },
      "WebhookFilterKeyDto": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "nullable": true
          },
          "expectedValue": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WebhookInboundMappingDto": {
        "type": "object",
        "properties": {
          "contactIdPath": {
            "type": "string",
            "nullable": true
          },
          "bodyPath": {
            "type": "string",
            "nullable": true
          },
          "attachmentsPath": {
            "type": "string",
            "nullable": true
          },
          "statePath": {
            "type": "string",
            "nullable": true
          },
          "contactFieldPaths": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WebhookIntegrationDto": {
        "type": "object",
        "properties": {
          "configured": {
            "type": "boolean"
          },
          "requireAccessToken": {
            "type": "boolean"
          },
          "inbound": {
            "$ref": "#/components/schemas/WebhookInboundMappingDto"
          },
          "filterKey": {
            "$ref": "#/components/schemas/WebhookFilterKeyDto"
          },
          "outboundMode": {
            "type": "string",
            "nullable": true
          },
          "sendMessageTemplate": {
            "$ref": "#/components/schemas/WebhookOutboundTemplateDto"
          },
          "setFieldTemplate": {
            "$ref": "#/components/schemas/WebhookOutboundTemplateDto"
          },
          "getContactTemplate": {
            "$ref": "#/components/schemas/WebhookOutboundTemplateDto"
          },
          "contactFieldResponsePaths": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "nullable": true
          },
          "webhookCallbackUri": {
            "type": "string",
            "nullable": true
          },
          "hasExternalApiKey": {
            "type": "boolean"
          },
          "listenUntil": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "contactFieldDescriptors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "lastTestResults": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/TestWebhookOutboundResult"
            },
            "nullable": true
          },
          "selectedSampleEventId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WebhookOutboundTemplateDto": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "nullable": true
          },
          "url": {
            "type": "string",
            "nullable": true
          },
          "headers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookTemplateHeaderDto"
            },
            "nullable": true
          },
          "bodyTemplate": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WebhookSampleDto": {
        "required": [
          "categoryKey",
          "instant",
          "kind"
        ],
        "type": "object",
        "properties": {
          "categoryKey": {
            "type": "string",
            "nullable": true
          },
          "kind": {
            "type": "string",
            "description": "The notification kind this sample is built from.",
            "nullable": true
          },
          "instant": {
            "type": "string",
            "description": "Pretty-printed body for an endpoint attached at the instant cadence.",
            "nullable": true
          },
          "digests": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Pretty-printed digest bodies, keyed by cadence wire value. Null for a category that\nforbids rollup, where no digest can ever be sent.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WebhookTemplateHeaderDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WebscrapePageDto": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "nullable": true
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "WebscrapePageUpdateDto": {
        "type": "object",
        "properties": {
          "pages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebscrapePageDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Key": {
        "type": "apiKey",
        "description": "CloseBot API Key Authorization",
        "name": "X-CB-KEY",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Key": [ ]
    }
  ],
  "tags": [
    {
      "name": "Account"
    },
    {
      "name": "AccountNotification"
    },
    {
      "name": "Agency"
    },
    {
      "name": "Analytics"
    },
    {
      "name": "Assistant"
    },
    {
      "name": "Billing"
    },
    {
      "name": "Bot"
    },
    {
      "name": "BotMetric"
    },
    {
      "name": "BotSourceVariable"
    },
    {
      "name": "BotTemplate"
    },
    {
      "name": "BotTesting"
    },
    {
      "name": "Dashboard"
    },
    {
      "name": "Hierarchy"
    },
    {
      "name": "Lead"
    },
    {
      "name": "Leaderboard"
    },
    {
      "name": "Library"
    },
    {
      "name": "LiveDemo"
    },
    {
      "name": "Notification"
    },
    {
      "name": "Persona"
    },
    {
      "name": "Report"
    },
    {
      "name": "SmartFAQ"
    },
    {
      "name": "Source"
    },
    {
      "name": "SourceChannel"
    },
    {
      "name": "Webhook"
    }
  ]
}