{
  "openapi": "3.1.0",
  "info": {
    "title": "External API",
    "version": "0.1.0",
    "description": "Called by browsers. Authenticated with the session cookie set by the Google or GitHub login under /api/auth. No endpoint here accepts SQL. All data endpoints act on the active workspace of the session."
  },
  "components": {
    "securitySchemes": {
      "sessionCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "__Secure-better-auth.session_token",
        "description": "Set by the Google or GitHub login under /api/auth (on plain http, in development: `better-auth.session_token`). Requests other than GET must also send an `Origin` header of a trusted origin. Role names on an operation: `member` = any member of the active workspace; `owner`, `admin` = owners and admins only; none = logged in, no workspace needed."
      }
    },
    "schemas": {
      "PostgresConnectorCreateInput": {
        "type": "object",
        "properties": {
          "kind": {
            "default": "postgres",
            "type": "string",
            "const": "postgres"
          },
          "alias": {
            "type": "string",
            "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,62}$",
            "description": "Name used in SQL, e.g. crm"
          },
          "host": {
            "type": "string",
            "minLength": 1,
            "maxLength": 253
          },
          "port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "database": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          },
          "username": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          },
          "sslMode": {
            "type": "string",
            "enum": [
              "require",
              "disable"
            ]
          },
          "statementTimeoutMs": {
            "type": "integer",
            "minimum": 100,
            "maximum": 60000
          },
          "password": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "description": "Write-only. Use a select-only role on your database."
          }
        },
        "required": [
          "alias",
          "host",
          "database",
          "username",
          "password"
        ],
        "additionalProperties": false
      },
      "BigQueryConnectorCreateInput": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "bigquery"
          },
          "alias": {
            "type": "string",
            "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,62}$",
            "description": "Name used in SQL, e.g. crm"
          },
          "live": {
            "default": false,
            "type": "boolean",
            "description": "true: queried in place, each read billed by Google (D38). false: synced into the lake (D28); the BigQuery sync is not built yet, so until then such a connector cannot be queried."
          },
          "project": {
            "type": "string",
            "minLength": 6,
            "maxLength": 100,
            "description": "Google Cloud project id"
          },
          "dataset": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024,
                "description": "Only this dataset (default: every dataset the key can read)"
              },
              {
                "type": "null"
              }
            ]
          },
          "billingProject": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 6,
                "maxLength": 100,
                "description": "Project billed for the reads (default: project)"
              },
              {
                "type": "null"
              }
            ]
          },
          "serviceAccountKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000,
            "description": "Write-only. The JSON key of a service account with the roles BigQuery Data Viewer and BigQuery Read Session User."
          }
        },
        "required": [
          "kind",
          "alias",
          "project",
          "serviceAccountKey"
        ],
        "additionalProperties": false,
        "description": "Synced into the lake by default (not built yet); queried in place with live: true, each read billed by Google."
      },
      "ConnectorCreateInput": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/BigQueryConnectorCreateInput"
          },
          {
            "$ref": "#/components/schemas/PostgresConnectorCreateInput"
          }
        ],
        "examples": [
          {
            "alias": "crm",
            "host": "db.example.com",
            "port": 5432,
            "database": "crm",
            "username": "readonly",
            "password": "a-select-only-password"
          },
          {
            "kind": "bigquery",
            "alias": "warehouse",
            "project": "example-analytics",
            "dataset": "sales",
            "live": true,
            "serviceAccountKey": "{\"type\":\"service_account\",\"client_email\":\"reader@example-analytics.iam.gserviceaccount.com\",\"private_key\":\"...\"}"
          }
        ]
      },
      "PostgresConnectorUpdateInput": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string",
            "minLength": 1,
            "maxLength": 253
          },
          "port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "database": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          },
          "username": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          },
          "sslMode": {
            "type": "string",
            "enum": [
              "require",
              "disable"
            ]
          },
          "statementTimeoutMs": {
            "type": "integer",
            "minimum": 100,
            "maximum": 60000
          },
          "password": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "description": "Write-only. Use a select-only role on your database."
          }
        },
        "additionalProperties": false
      },
      "BigQueryConnectorUpdateInput": {
        "type": "object",
        "properties": {
          "live": {
            "type": "boolean",
            "description": "true: queried in place, each read billed by Google (D38). false: synced into the lake (D28); the BigQuery sync is not built yet, so until then such a connector cannot be queried."
          },
          "project": {
            "type": "string",
            "minLength": 6,
            "maxLength": 100,
            "description": "Google Cloud project id"
          },
          "dataset": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024,
                "description": "Only this dataset (default: every dataset the key can read)"
              },
              {
                "type": "null"
              }
            ]
          },
          "billingProject": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 6,
                "maxLength": 100,
                "description": "Project billed for the reads (default: project)"
              },
              {
                "type": "null"
              }
            ]
          },
          "serviceAccountKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000,
            "description": "Write-only. The JSON key of a service account with the roles BigQuery Data Viewer and BigQuery Read Session User."
          }
        },
        "additionalProperties": false
      },
      "ConnectorUpdateInput": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/PostgresConnectorUpdateInput"
          },
          {
            "$ref": "#/components/schemas/BigQueryConnectorUpdateInput"
          }
        ],
        "examples": [
          {
            "password": "the-rotated-password"
          }
        ]
      },
      "RunSavedQueryInput": {
        "type": "object",
        "properties": {
          "params": {
            "default": {},
            "description": "One value per declared parameter.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "maxRows": {
            "default": 1000,
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          }
        },
        "examples": [
          {
            "params": {
              "since": "2026-11-01"
            },
            "maxRows": 1000
          }
        ]
      },
      "TableDescriptionCreateInput": {
        "type": "object",
        "properties": {
          "tableName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Qualified name as listed by GET /v1/sources, e.g. lake.customers"
          },
          "description": {
            "default": "",
            "type": "string",
            "maxLength": 4000
          },
          "columns": {
            "default": [],
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "column": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "description": {
                  "type": "string",
                  "maxLength": 2000
                }
              },
              "required": [
                "column",
                "description"
              ]
            }
          },
          "metrics": {
            "default": [],
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "definition": {
                  "type": "string",
                  "maxLength": 2000
                },
                "formula": {
                  "type": "string",
                  "maxLength": 2000,
                  "description": "How it is computed, e.g. sum(amount). Shown to the model as a hint; never run."
                }
              },
              "required": [
                "name",
                "definition",
                "formula"
              ]
            }
          }
        },
        "required": [
          "tableName"
        ],
        "examples": [
          {
            "tableName": "lake.customers",
            "description": "One row per customer.",
            "columns": [
              {
                "column": "customer_id",
                "description": "Unique customer number"
              }
            ],
            "metrics": [
              {
                "name": "customers",
                "definition": "Number of customers",
                "formula": "count(*)"
              }
            ]
          }
        ]
      },
      "TableDescriptionUpdateInput": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "maxLength": 4000
          },
          "columns": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "column": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "description": {
                  "type": "string",
                  "maxLength": 2000
                }
              },
              "required": [
                "column",
                "description"
              ]
            }
          },
          "metrics": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "definition": {
                  "type": "string",
                  "maxLength": 2000
                },
                "formula": {
                  "type": "string",
                  "maxLength": 2000,
                  "description": "How it is computed, e.g. sum(amount). Shown to the model as a hint; never run."
                }
              },
              "required": [
                "name",
                "definition",
                "formula"
              ]
            }
          }
        },
        "examples": [
          {
            "description": "One row per customer, including closed accounts."
          }
        ]
      },
      "DescriptionDraftRequestInput": {
        "type": "object",
        "properties": {
          "tableName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "required": [
          "tableName"
        ],
        "examples": [
          {
            "tableName": "lake.customers"
          }
        ]
      },
      "AskRequestInput": {
        "type": "object",
        "properties": {
          "question": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "conversationId": {
            "description": "Continue a conversation; omit to start a new one.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "question"
        ],
        "examples": [
          {
            "question": "How many customers do we have?"
          }
        ]
      },
      "UiCreateInput": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "What the UI should show or do, or (for a new version) what to change"
          }
        },
        "required": [
          "prompt"
        ],
        "examples": [
          {
            "prompt": "A dashboard of revenue per day since the start of the month"
          }
        ]
      },
      "UiRunInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "description": "Query name from the version, as passed to platform.run"
          },
          "params": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "maxRows": {
            "default": 1000,
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          }
        },
        "required": [
          "name"
        ],
        "examples": [
          {
            "name": "revenue_by_day",
            "params": {
              "since": "2026-11-01"
            }
          }
        ]
      },
      "SyncJobCreateInput": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "database"
              },
              "targetTable": {
                "type": "string",
                "pattern": "^[a-z_][a-z0-9_]{0,62}$",
                "description": "Lake table to write: lake.<targetTable>"
              },
              "intervalMinutes": {
                "default": 1440,
                "type": "integer",
                "minimum": 5,
                "maximum": 10080
              },
              "enabled": {
                "default": true,
                "type": "boolean"
              },
              "connectorId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                "description": "A connector of this workspace to read from"
              },
              "sourceTable": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,62}\\.[A-Za-z_][A-Za-z0-9_]{0,62}$",
                "description": "schema.table in that database"
              },
              "mode": {
                "default": "full",
                "type": "string",
                "enum": [
                  "full",
                  "incremental"
                ]
              },
              "cursorColumn": {
                "description": "incremental: rows with a higher value than last time are appended",
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,62}$"
              }
            },
            "required": [
              "kind",
              "targetTable",
              "connectorId",
              "sourceTable"
            ]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "file"
              },
              "targetTable": {
                "type": "string",
                "pattern": "^[a-z_][a-z0-9_]{0,62}$",
                "description": "Lake table to write: lake.<targetTable>"
              },
              "intervalMinutes": {
                "default": 1440,
                "type": "integer",
                "minimum": 5,
                "maximum": 10080
              },
              "enabled": {
                "default": true,
                "type": "boolean"
              },
              "fileName": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,200}$",
                "description": "A file in this workspace's upload area"
              },
              "fileFormat": {
                "type": "string",
                "enum": [
                  "csv",
                  "parquet"
                ]
              }
            },
            "required": [
              "kind",
              "targetTable",
              "fileName",
              "fileFormat"
            ]
          }
        ],
        "examples": [
          {
            "kind": "database",
            "connectorId": "6f1c2d3e-4a5b-4c6d-8e7f-90a1b2c3d4e5",
            "sourceTable": "public.orders",
            "targetTable": "orders",
            "intervalMinutes": 1440
          }
        ]
      },
      "SyncJobUpdateInput": {
        "type": "object",
        "properties": {
          "intervalMinutes": {
            "type": "integer",
            "minimum": 5,
            "maximum": 10080
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "examples": [
          {
            "enabled": false
          }
        ]
      },
      "ChatRequestInput": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "conversationId": {
            "description": "Continue a conversation; omit to start a new one.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "message"
        ],
        "examples": [
          {
            "message": "Create a dashboard around new customers"
          }
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable machine-readable code, e.g. query_not_allowed"
              },
              "message": {
                "type": "string"
              },
              "details": {}
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "error": {
              "code": "admin_required",
              "message": "Only workspace owners and admins can do this."
            }
          }
        ]
      },
      "SavedQueryParam": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,62}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "integer",
              "boolean",
              "date"
            ]
          },
          "required": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "type",
          "required"
        ],
        "additionalProperties": false
      },
      "QueryResult": {
        "type": "object",
        "properties": {
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "description": "DuckDB type, e.g. BIGINT, DECIMAL(18,2)"
                }
              },
              "required": [
                "name",
                "type"
              ],
              "additionalProperties": false
            }
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {}
            },
            "description": "One array per row. DECIMAL values are strings, dates are ISO strings."
          },
          "truncated": {
            "type": "boolean",
            "description": "True when more rows existed than maxRows."
          },
          "cached": {
            "type": "boolean",
            "description": "True when served from the result cache."
          },
          "elapsedMs": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "columns",
          "rows",
          "truncated",
          "cached",
          "elapsedMs"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "columns": [
              {
                "name": "day",
                "type": "DATE"
              },
              {
                "name": "revenue",
                "type": "DECIMAL(18,2)"
              }
            ],
            "rows": [
              [
                "2026-11-18",
                "1840.50"
              ],
              [
                "2026-11-19",
                "2213.75"
              ]
            ],
            "truncated": false,
            "cached": false,
            "elapsedMs": 42
          }
        ]
      },
      "Source": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "lake",
              "live"
            ]
          },
          "available": {
            "type": "boolean",
            "description": "False when a live source could not be reached."
          },
          "tables": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Qualified name to use in SQL"
                },
                "columns": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "type"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "name",
                "columns"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "name",
          "kind",
          "available",
          "tables"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "name": "crm",
            "kind": "live",
            "available": true,
            "tables": [
              {
                "name": "crm.public.orders",
                "columns": [
                  {
                    "name": "id",
                    "type": "INTEGER"
                  },
                  {
                    "name": "customer_id",
                    "type": "INTEGER"
                  },
                  {
                    "name": "amount",
                    "type": "DECIMAL(10,2)"
                  }
                ]
              }
            ]
          }
        ]
      },
      "SourceList": {
        "type": "object",
        "properties": {
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Source"
            }
          }
        },
        "required": [
          "sources"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "sources": [
              {
                "name": "lake",
                "kind": "lake",
                "available": true,
                "tables": [
                  {
                    "name": "lake.customers",
                    "columns": [
                      {
                        "name": "customer_id",
                        "type": "BIGINT"
                      },
                      {
                        "name": "name",
                        "type": "VARCHAR"
                      }
                    ]
                  }
                ]
              },
              {
                "name": "crm",
                "kind": "live",
                "available": true,
                "tables": [
                  {
                    "name": "crm.public.orders",
                    "columns": [
                      {
                        "name": "id",
                        "type": "INTEGER"
                      },
                      {
                        "name": "customer_id",
                        "type": "INTEGER"
                      },
                      {
                        "name": "amount",
                        "type": "DECIMAL(10,2)"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "Connector": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "alias": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "postgres",
              "bigquery"
            ]
          },
          "host": {
            "type": [
              "string",
              "null"
            ]
          },
          "port": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -2147483648,
                "maximum": 2147483647
              },
              {
                "type": "null"
              }
            ]
          },
          "database": {
            "type": [
              "string",
              "null"
            ]
          },
          "username": {
            "type": [
              "string",
              "null"
            ]
          },
          "project": {
            "type": [
              "string",
              "null"
            ]
          },
          "dataset": {
            "type": [
              "string",
              "null"
            ]
          },
          "billingProject": {
            "type": [
              "string",
              "null"
            ]
          },
          "live": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "sslMode": {
            "type": "string",
            "enum": [
              "require",
              "disable"
            ]
          },
          "statementTimeoutMs": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -2147483648,
                "maximum": 2147483647
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "id",
          "alias",
          "kind",
          "host",
          "port",
          "database",
          "username",
          "project",
          "dataset",
          "billingProject",
          "live",
          "sslMode",
          "statementTimeoutMs",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "6f1c2d3e-4a5b-4c6d-8e7f-90a1b2c3d4e5",
            "alias": "crm",
            "kind": "postgres",
            "host": "db.example.com",
            "port": 5432,
            "database": "crm",
            "username": "readonly",
            "project": null,
            "dataset": null,
            "billingProject": null,
            "live": null,
            "sslMode": "require",
            "statementTimeoutMs": 10000,
            "createdAt": "2026-11-20T09:30:00.000Z",
            "updatedAt": "2026-11-20T09:30:00.000Z"
          }
        ]
      },
      "SavedQuery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "params": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SavedQueryParam"
            }
          },
          "cacheTtlSeconds": {
            "type": "integer",
            "minimum": -2147483648,
            "maximum": 2147483647
          },
          "version": {
            "type": "integer",
            "minimum": -2147483648,
            "maximum": 2147483647
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "id",
          "name",
          "params",
          "cacheTtlSeconds",
          "version",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "1b2c3d4e-5f60-4718-9a2b-3c4d5e6f7a8b",
            "name": "revenue_by_day",
            "params": [
              {
                "name": "since",
                "type": "date",
                "required": true
              }
            ],
            "cacheTtlSeconds": 300,
            "version": 1,
            "createdAt": "2026-11-20T09:30:00.000Z",
            "updatedAt": "2026-11-20T09:30:00.000Z"
          }
        ]
      },
      "Me": {
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "email"
            ],
            "additionalProperties": false
          },
          "organization": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "slug": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "role": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name",
                  "slug",
                  "role"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "The active organization of this session; null when the user has no workspace yet."
          },
          "organizations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "slug": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "role": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "slug",
                "role"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "user",
          "organization",
          "organizations"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "user": {
              "id": "usr_3fT8kZ2bQ6vR9yWc",
              "name": "Owner A",
              "email": "owner@example.com"
            },
            "organization": {
              "id": "org_7Hq2LwX9pD4mN1sK",
              "name": "Example Retail",
              "slug": "example-retail",
              "role": "owner"
            },
            "organizations": [
              {
                "id": "org_7Hq2LwX9pD4mN1sK",
                "name": "Example Retail",
                "slug": "example-retail",
                "role": "owner"
              }
            ]
          }
        ]
      },
      "TableDescription": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "tableName": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "column": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "description": {
                  "type": "string",
                  "maxLength": 2000
                }
              },
              "required": [
                "column",
                "description"
              ],
              "additionalProperties": false
            }
          },
          "metrics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "definition": {
                  "type": "string",
                  "maxLength": 2000
                },
                "formula": {
                  "type": "string",
                  "maxLength": 2000,
                  "description": "How it is computed, e.g. sum(amount). Shown to the model as a hint; never run."
                }
              },
              "required": [
                "name",
                "definition",
                "formula"
              ],
              "additionalProperties": false
            }
          },
          "updatedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "id",
          "tableName",
          "description",
          "columns",
          "metrics",
          "updatedBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "2c3d4e5f-6071-4829-8b3c-4d5e6f7a8b9c",
            "tableName": "lake.customers",
            "description": "One row per customer.",
            "columns": [
              {
                "column": "customer_id",
                "description": "Unique customer number"
              },
              {
                "column": "name",
                "description": "Display name"
              }
            ],
            "metrics": [
              {
                "name": "customers",
                "definition": "Number of customers",
                "formula": "count(*)"
              }
            ],
            "updatedBy": "usr_3fT8kZ2bQ6vR9yWc",
            "createdAt": "2026-11-20T09:30:00.000Z",
            "updatedAt": "2026-11-20T09:30:00.000Z"
          }
        ]
      },
      "DescriptionDraft": {
        "type": "object",
        "properties": {
          "tableName": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "column": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "description": {
                  "type": "string",
                  "maxLength": 2000
                }
              },
              "required": [
                "column",
                "description"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "tableName",
          "description",
          "columns"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "tableName": "lake.customers",
            "description": "Customers of the shop.",
            "columns": [
              {
                "column": "customer_id",
                "description": "Unique customer number"
              },
              {
                "column": "name",
                "description": "Customer name"
              }
            ]
          }
        ]
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "role": {
            "type": "string",
            "enum": [
              "user",
              "assistant"
            ]
          },
          "content": {
            "type": "string"
          },
          "executedSql": {
            "type": [
              "string",
              "null"
            ]
          },
          "explanation": {
            "type": [
              "string",
              "null"
            ]
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "intent": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "question",
                  "dashboard",
                  "change_dashboard",
                  "clarify",
                  "other"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "uiId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "uiVersion": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -2147483648,
                "maximum": 2147483647
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "id",
          "role",
          "content",
          "executedSql",
          "explanation",
          "errorCode",
          "intent",
          "uiId",
          "uiVersion",
          "createdAt"
        ],
        "additionalProperties": false,
        "description": "executedSql is the statement that produced an answer, for read-only display.",
        "examples": [
          {
            "id": "5f607182-93a4-4b52-9e6f-7a8b9cadbecf",
            "role": "assistant",
            "content": "You have 50 customers.",
            "executedSql": "SELECT count(*) AS customers FROM lake.customers",
            "explanation": "Counted the rows of lake.customers.",
            "errorCode": null,
            "intent": "question",
            "uiId": null,
            "uiVersion": null,
            "createdAt": "2026-11-20T09:30:00.000Z"
          }
        ]
      },
      "Conversation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "title": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "id",
          "title",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "3d4e5f60-7182-4930-9c4d-5e6f7a8b9cad",
            "title": "How many customers do we have?",
            "createdAt": "2026-11-20T09:30:00.000Z",
            "updatedAt": "2026-11-20T09:30:00.000Z"
          }
        ]
      },
      "ConversationDetail": {
        "type": "object",
        "properties": {
          "conversation": {
            "$ref": "#/components/schemas/Conversation"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "description": "One page, oldest first"
          },
          "nextCursor": {
            "description": "Pass as `cursor` for the next page of messages; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "conversation",
          "messages",
          "nextCursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "conversation": {
              "id": "3d4e5f60-7182-4930-9c4d-5e6f7a8b9cad",
              "title": "How many customers do we have?",
              "createdAt": "2026-11-20T09:30:00.000Z",
              "updatedAt": "2026-11-20T09:30:00.000Z"
            },
            "messages": [
              {
                "id": "5f607182-93a4-4b52-9e6f-7a8b9cadbecf",
                "role": "assistant",
                "content": "You have 50 customers.",
                "executedSql": "SELECT count(*) AS customers FROM lake.customers",
                "explanation": "Counted the rows of lake.customers.",
                "errorCode": null,
                "intent": "question",
                "uiId": null,
                "uiVersion": null,
                "createdAt": "2026-11-20T09:30:00.000Z"
              }
            ],
            "nextCursor": null
          }
        ]
      },
      "AskEvent": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "generating"
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": [
                  "conversationId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "running"
              },
              "data": {
                "type": "object",
                "properties": {
                  "attempt": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "attempt"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "answer"
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "messageId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "summary": {
                    "type": "string"
                  },
                  "explanation": {
                    "type": "string"
                  },
                  "executedSql": {
                    "type": "string",
                    "description": "For read-only display; cannot be sent back."
                  },
                  "columns": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "description": "DuckDB type, e.g. BIGINT, DECIMAL(18,2)"
                        }
                      },
                      "required": [
                        "name",
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "rows": {
                    "type": "array",
                    "items": {
                      "type": "array",
                      "items": {}
                    },
                    "description": "One array per row. DECIMAL values are strings, dates are ISO strings."
                  },
                  "truncated": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "conversationId",
                  "messageId",
                  "summary",
                  "explanation",
                  "executedSql",
                  "columns",
                  "rows",
                  "truncated"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "error"
              },
              "data": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          }
        ],
        "examples": [
          {
            "event": "running",
            "data": {
              "attempt": 1
            }
          }
        ]
      },
      "Ui": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "title": {
            "type": "string"
          },
          "currentVersion": {
            "type": "integer",
            "minimum": -2147483648,
            "maximum": 2147483647
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "id",
          "title",
          "currentVersion",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "60718293-a4b5-4c63-8f70-8b9cadbecfd0",
            "title": "Revenue per day",
            "currentVersion": 2,
            "createdBy": "usr_3fT8kZ2bQ6vR9yWc",
            "createdAt": "2026-11-20T09:30:00.000Z",
            "updatedAt": "2026-11-20T10:15:00.000Z"
          }
        ]
      },
      "UiVersionView": {
        "type": "object",
        "properties": {
          "uiId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "title": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "html": {
            "type": "string",
            "description": "Put in <iframe sandbox=\"allow-scripts\" srcdoc=\"...\"> (never allow-same-origin). Starts with a CSP that forbids all network access."
          },
          "queries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "params": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SavedQueryParam"
                  }
                }
              },
              "required": [
                "name",
                "params"
              ],
              "additionalProperties": false
            },
            "description": "What the document may run through the bridge"
          }
        },
        "required": [
          "uiId",
          "version",
          "title",
          "prompt",
          "createdAt",
          "html",
          "queries"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "uiId": "60718293-a4b5-4c63-8f70-8b9cadbecfd0",
            "version": 2,
            "title": "Revenue per day",
            "prompt": "Show it as a bar chart",
            "createdAt": "2026-11-20T10:15:00.000Z",
            "html": "<!doctype html><html><head><meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; ...\">…</head><body>…</body></html>",
            "queries": [
              {
                "name": "revenue_by_day",
                "params": [
                  {
                    "name": "since",
                    "type": "date",
                    "required": true
                  }
                ]
              }
            ]
          }
        ]
      },
      "UiVersionSummary": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "prompt": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "version",
          "prompt",
          "createdAt"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "version": 2,
            "prompt": "Show it as a bar chart",
            "createdAt": "2026-11-20T10:15:00.000Z"
          }
        ]
      },
      "UiEvent": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "generating"
              },
              "data": {
                "type": "object",
                "properties": {
                  "uiId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "uiId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "checking"
              },
              "data": {
                "type": "object",
                "properties": {
                  "attempt": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "attempt"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "ui"
              },
              "data": {
                "type": "object",
                "properties": {
                  "uiId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "version": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "title": {
                    "type": "string"
                  }
                },
                "required": [
                  "uiId",
                  "version",
                  "title"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "error"
              },
              "data": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          }
        ],
        "examples": [
          {
            "event": "ui",
            "data": {
              "uiId": "60718293-a4b5-4c63-8f70-8b9cadbecfd0",
              "version": 1,
              "title": "New customers"
            }
          }
        ]
      },
      "SyncJob": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "targetTable": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "database",
              "file"
            ]
          },
          "connectorId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "sourceTable": {
            "type": [
              "string",
              "null"
            ]
          },
          "fileName": {
            "type": [
              "string",
              "null"
            ]
          },
          "fileFormat": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "csv",
                  "parquet"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "full",
              "incremental"
            ]
          },
          "cursorColumn": {
            "type": [
              "string",
              "null"
            ]
          },
          "cursorValue": {
            "type": [
              "string",
              "null"
            ]
          },
          "intervalMinutes": {
            "type": "integer",
            "minimum": -2147483648,
            "maximum": 2147483647
          },
          "enabled": {
            "type": "boolean"
          },
          "nextRunAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "id",
          "targetTable",
          "kind",
          "connectorId",
          "sourceTable",
          "fileName",
          "fileFormat",
          "mode",
          "cursorColumn",
          "cursorValue",
          "intervalMinutes",
          "enabled",
          "nextRunAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "718293a4-b5c6-4d74-a081-9cadbecfd0e1",
            "targetTable": "orders",
            "kind": "database",
            "connectorId": "6f1c2d3e-4a5b-4c6d-8e7f-90a1b2c3d4e5",
            "sourceTable": "public.orders",
            "fileName": null,
            "fileFormat": null,
            "mode": "full",
            "cursorColumn": null,
            "cursorValue": null,
            "intervalMinutes": 1440,
            "enabled": true,
            "nextRunAt": "2026-11-20T10:15:00.000Z",
            "createdAt": "2026-11-20T09:30:00.000Z",
            "updatedAt": "2026-11-20T09:30:00.000Z"
          }
        ]
      },
      "SyncRun": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "jobId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "ok",
              "failed"
            ]
          },
          "workerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "rows": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -2147483648,
                "maximum": 2147483647
              },
              {
                "type": "null"
              }
            ]
          },
          "durationMs": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -2147483648,
                "maximum": 2147483647
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "jobId",
          "status",
          "workerId",
          "rows",
          "durationMs",
          "error",
          "startedAt",
          "finishedAt"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "id": "8293a4b5-c6d7-4e85-b192-adbecfd0e1f2",
            "jobId": "718293a4-b5c6-4d74-a081-9cadbecfd0e1",
            "status": "ok",
            "workerId": "ingest-1",
            "rows": 200000,
            "durationMs": 5300,
            "error": null,
            "startedAt": "2026-11-20T09:30:00.000Z",
            "finishedAt": "2026-11-20T09:30:05.300Z"
          }
        ]
      },
      "SyncJobDetail": {
        "type": "object",
        "properties": {
          "job": {
            "$ref": "#/components/schemas/SyncJob"
          },
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SyncRun"
            }
          }
        },
        "required": [
          "job",
          "runs"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "job": {
              "id": "718293a4-b5c6-4d74-a081-9cadbecfd0e1",
              "targetTable": "orders",
              "kind": "database",
              "connectorId": "6f1c2d3e-4a5b-4c6d-8e7f-90a1b2c3d4e5",
              "sourceTable": "public.orders",
              "fileName": null,
              "fileFormat": null,
              "mode": "full",
              "cursorColumn": null,
              "cursorValue": null,
              "intervalMinutes": 1440,
              "enabled": true,
              "nextRunAt": "2026-11-20T10:15:00.000Z",
              "createdAt": "2026-11-20T09:30:00.000Z",
              "updatedAt": "2026-11-20T09:30:00.000Z"
            },
            "runs": [
              {
                "id": "8293a4b5-c6d7-4e85-b192-adbecfd0e1f2",
                "jobId": "718293a4-b5c6-4d74-a081-9cadbecfd0e1",
                "status": "ok",
                "workerId": "ingest-1",
                "rows": 200000,
                "durationMs": 5300,
                "error": null,
                "startedAt": "2026-11-20T09:30:00.000Z",
                "finishedAt": "2026-11-20T09:30:05.300Z"
              }
            ]
          }
        ]
      },
      "ChatEvent": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "routing"
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": [
                  "conversationId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "routed"
              },
              "data": {
                "type": "object",
                "properties": {
                  "intent": {
                    "type": "string",
                    "enum": [
                      "question",
                      "dashboard",
                      "change_dashboard",
                      "clarify",
                      "other"
                    ]
                  },
                  "uiId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "intent",
                  "uiId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "reply"
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "messageId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "intent": {
                    "type": "string",
                    "enum": [
                      "clarify",
                      "other"
                    ]
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "conversationId",
                  "messageId",
                  "intent",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "generating"
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "uiId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "conversationId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "running"
              },
              "data": {
                "type": "object",
                "properties": {
                  "attempt": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "attempt"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "checking"
              },
              "data": {
                "type": "object",
                "properties": {
                  "attempt": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "attempt"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "answer"
              },
              "data": {
                "type": "object",
                "properties": {
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "messageId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "summary": {
                    "type": "string"
                  },
                  "explanation": {
                    "type": "string"
                  },
                  "executedSql": {
                    "type": "string",
                    "description": "For read-only display; cannot be sent back."
                  },
                  "columns": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "description": "DuckDB type, e.g. BIGINT, DECIMAL(18,2)"
                        }
                      },
                      "required": [
                        "name",
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "rows": {
                    "type": "array",
                    "items": {
                      "type": "array",
                      "items": {}
                    },
                    "description": "One array per row. DECIMAL values are strings, dates are ISO strings."
                  },
                  "truncated": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "conversationId",
                  "messageId",
                  "summary",
                  "explanation",
                  "executedSql",
                  "columns",
                  "rows",
                  "truncated"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "ui"
              },
              "data": {
                "type": "object",
                "properties": {
                  "uiId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "version": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "title": {
                    "type": "string"
                  },
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": [
                  "uiId",
                  "version",
                  "title",
                  "conversationId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "const": "error"
              },
              "data": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "conversationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "event",
              "data"
            ],
            "additionalProperties": false
          }
        ],
        "examples": [
          {
            "event": "routed",
            "data": {
              "intent": "dashboard",
              "uiId": null
            }
          }
        ]
      },
      "ConnectorPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Connector"
            }
          },
          "nextCursor": {
            "description": "Pass as `cursor` to get the next page; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "id": "6f1c2d3e-4a5b-4c6d-8e7f-90a1b2c3d4e5",
                "alias": "crm",
                "kind": "postgres",
                "host": "db.example.com",
                "port": 5432,
                "database": "crm",
                "username": "readonly",
                "project": null,
                "dataset": null,
                "billingProject": null,
                "live": null,
                "sslMode": "require",
                "statementTimeoutMs": 10000,
                "createdAt": "2026-11-20T09:30:00.000Z",
                "updatedAt": "2026-11-20T09:30:00.000Z"
              }
            ],
            "nextCursor": null
          }
        ]
      },
      "SavedQueryPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SavedQuery"
            }
          },
          "nextCursor": {
            "description": "Pass as `cursor` to get the next page; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "id": "1b2c3d4e-5f60-4718-9a2b-3c4d5e6f7a8b",
                "name": "revenue_by_day",
                "params": [
                  {
                    "name": "since",
                    "type": "date",
                    "required": true
                  }
                ],
                "cacheTtlSeconds": 300,
                "version": 1,
                "createdAt": "2026-11-20T09:30:00.000Z",
                "updatedAt": "2026-11-20T09:30:00.000Z"
              }
            ],
            "nextCursor": null
          }
        ]
      },
      "TableDescriptionPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TableDescription"
            }
          },
          "nextCursor": {
            "description": "Pass as `cursor` to get the next page; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "id": "2c3d4e5f-6071-4829-8b3c-4d5e6f7a8b9c",
                "tableName": "lake.customers",
                "description": "One row per customer.",
                "columns": [
                  {
                    "column": "customer_id",
                    "description": "Unique customer number"
                  },
                  {
                    "column": "name",
                    "description": "Display name"
                  }
                ],
                "metrics": [
                  {
                    "name": "customers",
                    "definition": "Number of customers",
                    "formula": "count(*)"
                  }
                ],
                "updatedBy": "usr_3fT8kZ2bQ6vR9yWc",
                "createdAt": "2026-11-20T09:30:00.000Z",
                "updatedAt": "2026-11-20T09:30:00.000Z"
              }
            ],
            "nextCursor": null
          }
        ]
      },
      "ConversationPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Conversation"
            }
          },
          "nextCursor": {
            "description": "Pass as `cursor` to get the next page; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "id": "3d4e5f60-7182-4930-9c4d-5e6f7a8b9cad",
                "title": "How many customers do we have?",
                "createdAt": "2026-11-20T09:30:00.000Z",
                "updatedAt": "2026-11-20T09:30:00.000Z"
              }
            ],
            "nextCursor": null
          }
        ]
      },
      "UiPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Ui"
            }
          },
          "nextCursor": {
            "description": "Pass as `cursor` to get the next page; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "id": "60718293-a4b5-4c63-8f70-8b9cadbecfd0",
                "title": "Revenue per day",
                "currentVersion": 2,
                "createdBy": "usr_3fT8kZ2bQ6vR9yWc",
                "createdAt": "2026-11-20T09:30:00.000Z",
                "updatedAt": "2026-11-20T10:15:00.000Z"
              }
            ],
            "nextCursor": null
          }
        ]
      },
      "UiVersionPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UiVersionSummary"
            }
          },
          "nextCursor": {
            "description": "Pass as `cursor` to get the next page; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "version": 2,
                "prompt": "Show it as a bar chart",
                "createdAt": "2026-11-20T10:15:00.000Z"
              }
            ],
            "nextCursor": null
          }
        ]
      },
      "SyncJobPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SyncJob"
            }
          },
          "nextCursor": {
            "description": "Pass as `cursor` to get the next page; null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false,
        "examples": [
          {
            "items": [
              {
                "id": "718293a4-b5c6-4d74-a081-9cadbecfd0e1",
                "targetTable": "orders",
                "kind": "database",
                "connectorId": "6f1c2d3e-4a5b-4c6d-8e7f-90a1b2c3d4e5",
                "sourceTable": "public.orders",
                "fileName": null,
                "fileFormat": null,
                "mode": "full",
                "cursorColumn": null,
                "cursorValue": null,
                "intervalMinutes": 1440,
                "enabled": true,
                "nextRunAt": "2026-11-20T10:15:00.000Z",
                "createdAt": "2026-11-20T09:30:00.000Z",
                "updatedAt": "2026-11-20T09:30:00.000Z"
              }
            ],
            "nextCursor": null
          }
        ]
      }
    }
  },
  "paths": {
    "/healthz": {
      "get": {
        "operationId": "getHealth",
        "summary": "Liveness",
        "tags": [
          "ops"
        ],
        "description": "Answers 200 while the process runs. No login needed.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "getMe",
        "summary": "Who am I, and which workspaces can I use",
        "tags": [
          "identity"
        ],
        "description": "Needs a session, not a workspace: someone who belongs to no workspace gets `organization: null`. Switch the active workspace with `POST /api/auth/organization/set-active`.",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sources": {
      "get": {
        "operationId": "listSources",
        "summary": "Tables and columns this workspace can query",
        "tags": [
          "data"
        ],
        "description": "The lake's tables and those of each live source, with column names and types. A live source that cannot be reached is listed with `available: false`; the others are still listed.",
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceList"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/connectors": {
      "get": {
        "operationId": "listConnectors",
        "summary": "List live data sources",
        "tags": [
          "connectors"
        ],
        "description": "Paginated, oldest first. Passwords are never returned.",
        "parameters": [
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Items per page"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "`nextCursor` of the previous page"
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectorPage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createConnector",
        "summary": "Add a live data source",
        "tags": [
          "connectors"
        ],
        "description": "Owners and admins only. PostgreSQL (kind omitted or `postgres`) or BigQuery (`bigquery`; synced by default, queried in place with `live: true`). The password or key is stored encrypted and never returned.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectorCreateInput"
              }
            }
          }
        },
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Connector"
                }
              }
            }
          },
          "400": {
            "description": "Refused: the input is not allowed (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflicts with the current state (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ]
      }
    },
    "/v1/connectors/{id}": {
      "patch": {
        "operationId": "updateConnector",
        "summary": "Change a live data source or rotate its password or key",
        "tags": [
          "connectors"
        ],
        "description": "Owners and admins only. Only the fields of the connector's own kind are accepted, and fields left out stay as they are. A new `password` (PostgreSQL) or `serviceAccountKey` (BigQuery) replaces the stored one. A changed host, TLS setting, project, dataset or billing project is checked again.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectorUpdateInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Connector"
                }
              }
            }
          },
          "400": {
            "description": "Refused: the input is not allowed (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteConnector",
        "summary": "Remove a live data source",
        "tags": [
          "connectors"
        ],
        "description": "Owners and admins only. Its stored password is deleted, and so are the sync jobs that read from it (the lake tables they wrote stay).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/saved-queries": {
      "get": {
        "operationId": "listSavedQueries",
        "summary": "List saved queries",
        "tags": [
          "saved queries"
        ],
        "description": "SQL text is not exposed to browsers.",
        "parameters": [
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Items per page"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "`nextCursor` of the previous page"
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedQueryPage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/saved-queries/{id}": {
      "get": {
        "operationId": "getSavedQuery",
        "summary": "One saved query with the parameters it expects",
        "tags": [
          "saved queries"
        ],
        "description": "Its name, declared parameters and cache setting. The SQL is not exposed.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedQuery"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/saved-queries/{id}/run": {
      "post": {
        "operationId": "runSavedQuery",
        "summary": "Run a saved query with parameter values",
        "tags": [
          "saved queries"
        ],
        "description": "The only data call a generated UI makes. Values are checked against the declared parameters and bound, never spliced into SQL.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunSavedQueryInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryResult"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "The query took too long (`query_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/table-descriptions": {
      "get": {
        "operationId": "listTableDescriptions",
        "summary": "List table descriptions",
        "tags": [
          "semantic layer"
        ],
        "description": "Paginated, oldest first. Members read them; owners and admins write them.",
        "parameters": [
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Items per page"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "`nextCursor` of the previous page"
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TableDescriptionPage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createTableDescription",
        "summary": "Describe a table, its columns and metrics",
        "tags": [
          "semantic layer"
        ],
        "description": "Owners and admins only. Included in the prompt when someone asks a question.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TableDescriptionCreateInput"
              }
            }
          }
        },
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TableDescription"
                }
              }
            }
          },
          "400": {
            "description": "Refused: the input is not allowed (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflicts with the current state (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ]
      }
    },
    "/v1/table-descriptions/{id}": {
      "patch": {
        "operationId": "updateTableDescription",
        "summary": "Change a table description",
        "tags": [
          "semantic layer"
        ],
        "description": "Owners and admins only. Fields left out stay as they are.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TableDescriptionUpdateInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TableDescription"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteTableDescription",
        "summary": "Remove a table description",
        "tags": [
          "semantic layer"
        ],
        "description": "Owners and admins only.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/table-descriptions/draft": {
      "post": {
        "operationId": "draftTableDescription",
        "summary": "Draft a description with the language model",
        "tags": [
          "semantic layer"
        ],
        "description": "Owners and admins only. Sends table and column names and types, no data. Returns a draft; nothing is stored.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DescriptionDraftRequestInput"
              }
            }
          }
        },
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DescriptionDraft"
                }
              }
            }
          },
          "400": {
            "description": "Refused: the input is not allowed (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ]
      }
    },
    "/v1/ask": {
      "post": {
        "operationId": "askQuestion",
        "summary": "Ask a question about the workspace data in plain language",
        "tags": [
          "ask"
        ],
        "description": "Answers with server-sent events (`text/event-stream`), in order: `generating`, `running` (once per attempt; failed SQL is repaired at most twice), then `answer` or `error`. Each event's data is the `data` of one `AskEvent` variant. Errors before the stream starts use the normal error shape.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AskRequestInput"
              }
            }
          }
        },
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "One event of the stream",
            "content": {
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/AskEvent"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflicts with the current state (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ]
      }
    },
    "/v1/conversations": {
      "get": {
        "operationId": "listConversations",
        "summary": "My conversations in this workspace",
        "tags": [
          "ask"
        ],
        "description": "Only the caller's own conversations in the active workspace. Paginated, oldest first.",
        "parameters": [
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Items per page"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "`nextCursor` of the previous page"
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationPage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversations/{id}": {
      "get": {
        "operationId": "getConversation",
        "summary": "One of my conversations with its messages (paginated)",
        "tags": [
          "ask"
        ],
        "description": "Only the caller's own. Its messages are paginated with `limit` and `cursor`, oldest first; an answer carries the SQL that produced it, for display only.",
        "parameters": [
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Items per page"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "`nextCursor` of the previous page"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationDetail"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uis": {
      "get": {
        "operationId": "listUis",
        "summary": "Gallery: the generated UIs of this workspace",
        "tags": [
          "uis"
        ],
        "description": "Every generated UI of the workspace, whoever made it. Paginated, oldest first.",
        "parameters": [
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Items per page"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "`nextCursor` of the previous page"
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UiPage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createUi",
        "summary": "Generate a UI from a prompt",
        "tags": [
          "uis"
        ],
        "description": "Answers with server-sent events (`text/event-stream`): `generating`, `checking` (once per attempt; a UI that fails its checks is repaired at most twice), then `ui` or `error`. Each event's data is the `data` of one `UiEvent` variant. Errors before the stream starts use the normal error shape.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UiCreateInput"
              }
            }
          }
        },
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "One event of the stream",
            "content": {
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/UiEvent"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflicts with the current state (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ]
      }
    },
    "/v1/uis/{id}": {
      "get": {
        "operationId": "getUi",
        "summary": "One generated UI",
        "tags": [
          "uis"
        ],
        "description": "Its title and current version number.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ui"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteUi",
        "summary": "Delete a UI with all its versions",
        "tags": [
          "uis"
        ],
        "description": "Its creator, owners and admins.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uis/{id}/versions": {
      "get": {
        "operationId": "listUiVersions",
        "summary": "Versions of a UI, oldest first",
        "tags": [
          "uis"
        ],
        "description": "Paginated, oldest first. Older versions keep working.",
        "parameters": [
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Items per page"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "`nextCursor` of the previous page"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UiVersionPage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createUiVersion",
        "summary": "Change a UI by prompt: generates a new version",
        "tags": [
          "uis"
        ],
        "description": "Answers with server-sent events (`text/event-stream`): `generating`, `checking` (once per attempt; a UI that fails its checks is repaired at most twice), then `ui` or `error`. Each event's data is the `data` of one `UiEvent` variant. Errors before the stream starts use the normal error shape.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UiCreateInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "One event of the stream",
            "content": {
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/UiEvent"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uis/{id}/versions/{version}": {
      "get": {
        "operationId": "getUiVersion",
        "summary": "A version for the viewer: sandbox HTML and its query names",
        "tags": [
          "uis"
        ],
        "description": "The HTML document to show in a sandboxed iframe, and the names and parameters of the queries it may run. No SQL.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "version",
            "required": true
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UiVersionView"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uis/{id}/versions/{version}/run": {
      "post": {
        "operationId": "runUiQuery",
        "summary": "Run one of the queries of a UI version (the bridge calls this)",
        "tags": [
          "uis"
        ],
        "description": "Refused (404) for any name that is not part of this version. Values are checked against the declared parameters and bound.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UiRunInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "version",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryResult"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "The query took too long (`query_timeout`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/chat": {
      "post": {
        "operationId": "sendChatMessage",
        "summary": "Send a chat message: a question, a dashboard to build or change, or anything else",
        "tags": [
          "chat"
        ],
        "description": "Answers with server-sent events (`text/event-stream`): `routing`, `routed` (what the message is), then `reply`, or the events of the flow it was routed to: a question (`generating`, `running`, `answer` | `error`) or a dashboard (`generating`, `checking`, `ui` | `error`). Each event's data is the `data` of one `ChatEvent` variant. Errors before the stream starts use the normal error shape.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequestInput"
              }
            }
          }
        },
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "One event of the stream",
            "content": {
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/ChatEvent"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflicts with the current state (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable (see the error code); retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ]
      }
    },
    "/v1/sync-jobs": {
      "get": {
        "operationId": "listSyncJobs",
        "summary": "List sync jobs",
        "tags": [
          "sync"
        ],
        "description": "Paginated, oldest first. Members read them; owners and admins change them.",
        "parameters": [
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Items per page"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "`nextCursor` of the previous page"
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncJobPage"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSyncJob",
        "summary": "Copy a database table or an uploaded file into the lake on a schedule",
        "tags": [
          "sync"
        ],
        "description": "Owners and admins only. The first run is due at once. The data becomes lake.<targetTable>.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SyncJobCreateInput"
              }
            }
          }
        },
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncJob"
                }
              }
            }
          },
          "400": {
            "description": "Refused: the input is not allowed (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflicts with the current state (see the error code)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ]
      }
    },
    "/v1/sync-jobs/{id}": {
      "get": {
        "operationId": "getSyncJob",
        "summary": "A sync job with its recent runs",
        "tags": [
          "sync"
        ],
        "description": "With its 20 most recent runs, newest first.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "member"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncJobDetail"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateSyncJob",
        "summary": "Change the schedule of a sync job, or pause it",
        "tags": [
          "sync"
        ],
        "description": "Owners and admins only. `enabled: false` pauses it. Fields left out stay as they are.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SyncJobUpdateInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncJob"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteSyncJob",
        "summary": "Delete a sync job and its run history",
        "tags": [
          "sync"
        ],
        "description": "The lake table it wrote stays.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sync-jobs/{id}/run": {
      "post": {
        "operationId": "runSyncJob",
        "summary": "Run a sync job as soon as possible",
        "tags": [
          "sync"
        ],
        "description": "Owners and admins only. Makes the job due now; a worker picks it up on its next claim. Answers at once; follow the run with `GET /v1/sync-jobs/{id}`.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://api.dev.loupestack.com",
            "description": "A trusted origin: this API's own or the web app's. Browsers send it themselves; otherwise `403 csrf_check_failed`."
          }
        ],
        "security": [
          {
            "sessionCookie": [
              "owner",
              "admin"
            ]
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued"
                      ]
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "status": "queued"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated (`unauthenticated`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed: `no_workspace`, `admin_required` or `csrf_check_failed`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request does not match the schema (`invalid_request`), or its values or query were refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.dev.loupestack.com"
    }
  ]
}
