{
  "components": {
    "schemas": {
      "A1Response": {
        "additionalProperties": true,
        "properties": {
          "range": {
            "title": "Range",
            "type": "string"
          },
          "values": {
            "items": {
              "items": {},
              "type": "array"
            },
            "title": "Values",
            "type": "array"
          }
        },
        "required": [
          "range",
          "values"
        ],
        "title": "A1Response",
        "type": "object"
      },
      "A1WriteRequest": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "expected_version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Version"
          },
          "range": {
            "maxLength": 30,
            "minLength": 2,
            "title": "Range",
            "type": "string"
          },
          "values": {
            "items": {
              "items": {},
              "maxItems": 1000,
              "type": "array"
            },
            "maxItems": 1000,
            "minItems": 1,
            "title": "Values",
            "type": "array"
          }
        },
        "required": [
          "range",
          "values",
          "expected_version"
        ],
        "title": "A1WriteRequest",
        "type": "object"
      },
      "AccountAutoTopupRequest": {
        "properties": {
          "account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id"
          },
          "amount": {
            "default": 5000,
            "title": "Amount",
            "type": "integer"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "threshold": {
            "default": 1000,
            "title": "Threshold",
            "type": "integer"
          }
        },
        "required": [
          "enabled"
        ],
        "title": "AccountAutoTopupRequest",
        "type": "object"
      },
      "AddColumnRequest": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "column": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Column",
            "type": "string"
          },
          "default": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Default"
          },
          "expected_version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Version"
          },
          "type": {
            "default": "VARCHAR",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "column",
          "expected_version"
        ],
        "title": "AddColumnRequest",
        "type": "object"
      },
      "AlterColumnRequest": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "expected_version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Version"
          },
          "new_name": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "New Name"
          },
          "type": {
            "anyOf": [
              {
                "maxLength": 50,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Type"
          }
        },
        "required": [
          "expected_version"
        ],
        "title": "AlterColumnRequest",
        "type": "object"
      },
      "AnnotateRequest": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "annotations": {
            "items": {
              "$ref": "#/components/schemas/StyleAnnotation"
            },
            "maxItems": 500,
            "minItems": 1,
            "title": "Annotations",
            "type": "array"
          }
        },
        "required": [
          "annotations"
        ],
        "title": "AnnotateRequest",
        "type": "object"
      },
      "ArtifactDescriptionBody": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          }
        },
        "title": "ArtifactDescriptionBody",
        "type": "object"
      },
      "ArtifactListResponse": {
        "additionalProperties": true,
        "properties": {
          "artifacts": {
            "items": {
              "$ref": "#/components/schemas/ArtifactSummary"
            },
            "title": "Artifacts",
            "type": "array"
          }
        },
        "required": [
          "artifacts"
        ],
        "title": "ArtifactListResponse",
        "type": "object"
      },
      "ArtifactStateResponse": {
        "additionalProperties": true,
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "state": {
            "title": "State",
            "type": "string"
          },
          "table_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Table Name"
          },
          "type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Type"
          }
        },
        "required": [
          "name",
          "state"
        ],
        "title": "ArtifactStateResponse",
        "type": "object"
      },
      "ArtifactSummary": {
        "additionalProperties": true,
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "row_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Row Count"
          },
          "schema": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Schema"
          },
          "state": {
            "default": "active",
            "enum": [
              "active",
              "archived"
            ],
            "title": "State",
            "type": "string"
          },
          "table_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Table Name"
          },
          "type": {
            "title": "Type",
            "type": "string"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "workbook_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Workbook Id"
          }
        },
        "required": [
          "name",
          "type"
        ],
        "title": "ArtifactSummary",
        "type": "object"
      },
      "BindRequest": {
        "properties": {
          "actor": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Actor",
            "type": "string"
          },
          "direction": {
            "default": "bidirectional",
            "enum": [
              "pull",
              "push",
              "bidirectional"
            ],
            "title": "Direction",
            "type": "string"
          },
          "external_kind": {
            "enum": [
              "google_sheets",
              "sharepoint"
            ],
            "title": "External Kind",
            "type": "string"
          },
          "external_ref": {
            "maxLength": 1000,
            "minLength": 1,
            "title": "External Ref",
            "type": "string"
          },
          "ownership_map": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ownership Map"
          }
        },
        "required": [
          "external_kind",
          "external_ref",
          "actor"
        ],
        "title": "BindRequest",
        "type": "object"
      },
      "Body_merge_export_api_v1_workbooks__workbook_id__tables__name__merge_post": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "branch_id": {
            "title": "Branch Id",
            "type": "string"
          },
          "file": {
            "contentMediaType": "application/octet-stream",
            "title": "File",
            "type": "string"
          }
        },
        "required": [
          "file",
          "branch_id"
        ],
        "title": "Body_merge_export_api_v1_workbooks__workbook_id__tables__name__merge_post",
        "type": "object"
      },
      "Body_post_source_api_v1_workbooks__workbook_id__sources_post": {
        "properties": {
          "async": {
            "default": false,
            "title": "Async",
            "type": "boolean"
          },
          "file": {
            "contentMediaType": "application/octet-stream",
            "title": "File",
            "type": "string"
          },
          "mode": {
            "default": "auto",
            "enum": [
              "auto",
              "staged"
            ],
            "title": "Mode",
            "type": "string"
          },
          "structuring": {
            "anyOf": [
              {
                "enum": [
                  "auto",
                  "skip",
                  "defer"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": "auto",
            "title": "Structuring"
          }
        },
        "required": [
          "file"
        ],
        "title": "Body_post_source_api_v1_workbooks__workbook_id__sources_post",
        "type": "object"
      },
      "Body_push_file_link_version_api_v1_workbooks__workbook_id__file_links__link_id__versions_post": {
        "properties": {
          "file": {
            "contentMediaType": "application/octet-stream",
            "title": "File",
            "type": "string"
          },
          "modified_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Modified By"
          },
          "modified_time": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Modified Time"
          }
        },
        "required": [
          "file"
        ],
        "title": "Body_push_file_link_version_api_v1_workbooks__workbook_id__file_links__link_id__versions_post",
        "type": "object"
      },
      "Body_sync_returned_file_api_v1_workbooks__workbook_id__sync_post": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "branch_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Branch Id"
          },
          "file": {
            "contentMediaType": "application/octet-stream",
            "title": "File",
            "type": "string"
          }
        },
        "required": [
          "file"
        ],
        "title": "Body_sync_returned_file_api_v1_workbooks__workbook_id__sync_post",
        "type": "object"
      },
      "Body_track_local_file_api_v1_workbooks__workbook_id__file_links_local_post": {
        "properties": {
          "as_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Name"
          },
          "file": {
            "contentMediaType": "application/octet-stream",
            "title": "File",
            "type": "string"
          },
          "on_existing": {
            "default": "auto",
            "pattern": "^(auto|seed|replace|refuse)$",
            "title": "On Existing",
            "type": "string"
          },
          "origin": {
            "default": "",
            "title": "Origin",
            "type": "string"
          }
        },
        "required": [
          "file"
        ],
        "title": "Body_track_local_file_api_v1_workbooks__workbook_id__file_links_local_post",
        "type": "object"
      },
      "ChartInfo": {
        "additionalProperties": true,
        "description": "A chart artifact: the rendered ``config`` plus the ``recipe`` (tool +\nparams) that produced it — the replayable definition. Read-only through\nthe API; ``config`` is omitted on governed workbooks.",
        "properties": {
          "artifact_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Artifact Id"
          },
          "chart_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Chart Type"
          },
          "config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config"
          },
          "config_omitted": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config Omitted"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "recipe": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recipe"
          },
          "source_table": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Table"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          }
        },
        "required": [
          "name"
        ],
        "title": "ChartInfo",
        "type": "object"
      },
      "ChartListResponse": {
        "additionalProperties": true,
        "properties": {
          "charts": {
            "items": {
              "$ref": "#/components/schemas/ChartInfo"
            },
            "title": "Charts",
            "type": "array"
          }
        },
        "required": [
          "charts"
        ],
        "title": "ChartListResponse",
        "type": "object"
      },
      "CloudImportRequest": {
        "properties": {
          "file_id": {
            "description": "Drive item id (SharePoint) or file id (Google Drive)",
            "minLength": 1,
            "title": "File Id",
            "type": "string"
          },
          "filename": {
            "description": "Name to register the source under (keep the extension)",
            "minLength": 1,
            "title": "Filename",
            "type": "string"
          },
          "provider": {
            "enum": [
              "sharepoint",
              "google_drive"
            ],
            "title": "Provider",
            "type": "string"
          }
        },
        "required": [
          "provider",
          "file_id",
          "filename"
        ],
        "title": "CloudImportRequest",
        "type": "object"
      },
      "ColumnDescriptionBody": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          }
        },
        "title": "ColumnDescriptionBody",
        "type": "object"
      },
      "ColumnInfo": {
        "additionalProperties": true,
        "properties": {
          "column": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Column"
          },
          "masked": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Masked"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Type"
          }
        },
        "title": "ColumnInfo",
        "type": "object"
      },
      "ColumnSpec": {
        "properties": {
          "name": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "type": {
            "default": "VARCHAR",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "ColumnSpec",
        "type": "object"
      },
      "ColumnsResponse": {
        "additionalProperties": true,
        "properties": {
          "columns": {
            "items": {
              "$ref": "#/components/schemas/ColumnInfo"
            },
            "title": "Columns",
            "type": "array"
          },
          "edit_version": {
            "title": "Edit Version",
            "type": "integer"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "table_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Table Name"
          }
        },
        "required": [
          "name",
          "edit_version",
          "columns"
        ],
        "title": "ColumnsResponse",
        "type": "object"
      },
      "CommitSnapshotRequest": {
        "properties": {
          "event_type": {
            "default": "transform",
            "title": "Event Type",
            "type": "string"
          },
          "summary": {
            "title": "Summary",
            "type": "string"
          }
        },
        "required": [
          "summary"
        ],
        "title": "CommitSnapshotRequest",
        "type": "object"
      },
      "ConfigureWorkspaceRequest": {
        "properties": {
          "idp_config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Idp Config"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 120,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "preprocess_rules": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preprocess Rules"
          },
          "residency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Residency"
          }
        },
        "title": "ConfigureWorkspaceRequest",
        "type": "object"
      },
      "CreateAccountRequest": {
        "properties": {
          "name": {
            "maxLength": 120,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "CreateAccountRequest",
        "type": "object"
      },
      "CreateKeyRequest": {
        "properties": {
          "account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "rate_limit_per_minute": {
            "default": 600,
            "maximum": 10000.0,
            "minimum": 1.0,
            "title": "Rate Limit Per Minute",
            "type": "integer"
          },
          "scopes": {
            "items": {
              "enum": [
                "workbooks:read",
                "workbooks:write",
                "workbooks:delete",
                "cloud-files:read",
                "governance:configure",
                "workspaces:read",
                "workspaces:create",
                "workspaces:configure",
                "workspaces:delete",
                "keys:read",
                "keys:mint",
                "keys:revoke",
                "account:read",
                "billing:manage"
              ],
              "type": "string"
            },
            "minItems": 1,
            "title": "Scopes",
            "type": "array"
          },
          "workspace_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Workspace Id"
          }
        },
        "required": [
          "scopes"
        ],
        "title": "CreateKeyRequest",
        "type": "object"
      },
      "CreateTableRequest": {
        "properties": {
          "columns": {
            "items": {
              "$ref": "#/components/schemas/ColumnSpec"
            },
            "maxItems": 200,
            "minItems": 1,
            "title": "Columns",
            "type": "array"
          },
          "name": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name",
          "columns"
        ],
        "title": "CreateTableRequest",
        "type": "object"
      },
      "CreateTableResponse": {
        "additionalProperties": true,
        "properties": {
          "table": {
            "$ref": "#/components/schemas/CreatedTable"
          }
        },
        "required": [
          "table"
        ],
        "title": "CreateTableResponse",
        "type": "object"
      },
      "CreateTokenRequest": {
        "properties": {
          "account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id"
          },
          "expires_in_days": {
            "anyOf": [
              {
                "maximum": 365.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires In Days"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "rate_limit_per_minute": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rate Limit Per Minute"
          },
          "resource": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resource"
          },
          "scopes": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "workbooks:read",
                    "workbooks:write",
                    "workbooks:delete",
                    "cloud-files:read",
                    "governance:configure",
                    "workspaces:read",
                    "workspaces:create",
                    "workspaces:configure",
                    "workspaces:delete",
                    "keys:read",
                    "keys:mint",
                    "keys:revoke",
                    "account:read",
                    "billing:manage"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scopes"
          }
        },
        "required": [
          "name"
        ],
        "title": "CreateTokenRequest",
        "type": "object"
      },
      "CreateVersionRequest": {
        "properties": {
          "label": {
            "maxLength": 120,
            "minLength": 1,
            "title": "Label",
            "type": "string"
          },
          "summary": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          }
        },
        "required": [
          "label"
        ],
        "title": "CreateVersionRequest",
        "type": "object"
      },
      "CreateWebhookRequest": {
        "properties": {
          "events": {
            "items": {
              "enum": [
                "artifact.updated",
                "artifact.deleted",
                "artifact.stale",
                "snapshot.committed",
                "source.analyzed",
                "source.materialized",
                "conflict.created",
                "version.branched",
                "version.merged",
                "job.completed"
              ],
              "type": "string"
            },
            "title": "Events",
            "type": "array"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "CreateWebhookRequest",
        "type": "object"
      },
      "CreatedTable": {
        "additionalProperties": true,
        "properties": {
          "edit_version": {
            "title": "Edit Version",
            "type": "integer"
          },
          "layer": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Layer"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "table_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Table Name"
          },
          "type": {
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "name",
          "type",
          "edit_version"
        ],
        "title": "CreatedTable",
        "type": "object"
      },
      "DeleteAccountRequest": {
        "properties": {
          "account_id": {
            "title": "Account Id",
            "type": "string"
          },
          "confirm": {
            "title": "Confirm",
            "type": "string"
          }
        },
        "required": [
          "account_id",
          "confirm"
        ],
        "title": "DeleteAccountRequest",
        "type": "object"
      },
      "DeleteAnnotationsRequest": {
        "properties": {
          "targets": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "maxItems": 500,
            "minItems": 1,
            "title": "Targets",
            "type": "array"
          }
        },
        "required": [
          "targets"
        ],
        "title": "DeleteAnnotationsRequest",
        "type": "object"
      },
      "DeleteRowsRequest": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "expected_version": {
            "title": "Expected Version",
            "type": "integer"
          },
          "row_ids": {
            "items": {
              "type": "integer"
            },
            "maxItems": 1000,
            "minItems": 1,
            "title": "Row Ids",
            "type": "array"
          }
        },
        "required": [
          "row_ids",
          "expected_version"
        ],
        "title": "DeleteRowsRequest",
        "type": "object"
      },
      "DeleteRowsResponse": {
        "additionalProperties": true,
        "properties": {
          "deleted": {
            "title": "Deleted",
            "type": "integer"
          },
          "table_name": {
            "title": "Table Name",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "integer"
          }
        },
        "required": [
          "table_name",
          "version",
          "deleted"
        ],
        "title": "DeleteRowsResponse",
        "type": "object"
      },
      "DevCheckoutRequest": {
        "properties": {
          "account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id"
          },
          "billing": {
            "default": "monthly",
            "title": "Billing",
            "type": "string"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          }
        },
        "required": [
          "tier"
        ],
        "title": "DevCheckoutRequest",
        "type": "object"
      },
      "DevPortalRequest": {
        "properties": {
          "account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id"
          }
        },
        "title": "DevPortalRequest",
        "type": "object"
      },
      "DevTopupRequest": {
        "properties": {
          "account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id"
          },
          "credits": {
            "title": "Credits",
            "type": "integer"
          }
        },
        "required": [
          "credits"
        ],
        "title": "DevTopupRequest",
        "type": "object"
      },
      "DropOverrideRequest": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "column_name": {
            "title": "Column Name",
            "type": "string"
          },
          "row_id": {
            "title": "Row Id",
            "type": "integer"
          }
        },
        "required": [
          "row_id",
          "column_name"
        ],
        "title": "DropOverrideRequest",
        "type": "object"
      },
      "ExportRequest": {
        "properties": {
          "format": {
            "default": "xlsx",
            "enum": [
              "xlsx",
              "csv"
            ],
            "title": "Format",
            "type": "string"
          },
          "formula_mode": {
            "default": "values",
            "enum": [
              "values",
              "preserve",
              "generate"
            ],
            "title": "Formula Mode",
            "type": "string"
          },
          "include_row_ids": {
            "default": false,
            "title": "Include Row Ids",
            "type": "boolean"
          },
          "record_branch": {
            "default": false,
            "title": "Record Branch",
            "type": "boolean"
          },
          "tables": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tables"
          }
        },
        "title": "ExportRequest",
        "type": "object"
      },
      "Freshness": {
        "additionalProperties": true,
        "properties": {
          "stale": {
            "title": "Stale",
            "type": "boolean"
          },
          "stale_since": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stale Since"
          }
        },
        "required": [
          "stale"
        ],
        "title": "Freshness",
        "type": "object"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "HeadingBlock": {
        "additionalProperties": false,
        "properties": {
          "kind": {
            "const": "heading",
            "title": "Kind",
            "type": "string"
          },
          "span": {
            "anyOf": [
              {
                "maximum": 50.0,
                "minimum": 2.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Span"
          },
          "style": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StyleProps"
              },
              {
                "type": "null"
              }
            ]
          },
          "text": {
            "minLength": 1,
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "text"
        ],
        "title": "HeadingBlock",
        "type": "object"
      },
      "IngestResponse": {
        "additionalProperties": true,
        "description": "Synchronous ingest result; the async form returns\n:class:`JobAcceptedResponse` instead (status 202).",
        "properties": {
          "artifacts": {
            "default": [],
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Artifacts",
            "type": "array"
          },
          "content_sha256": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content Sha256"
          },
          "deduplicated": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deduplicated"
          },
          "mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mode"
          },
          "source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SourceInfo"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "IngestResponse",
        "type": "object"
      },
      "JobAcceptedResponse": {
        "additionalProperties": true,
        "properties": {
          "content_sha256": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content Sha256"
          },
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mode"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "job_id",
          "status"
        ],
        "title": "JobAcceptedResponse",
        "type": "object"
      },
      "JobListResponse": {
        "additionalProperties": true,
        "properties": {
          "jobs": {
            "items": {
              "$ref": "#/components/schemas/JobResponse"
            },
            "title": "Jobs",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "jobs",
          "total"
        ],
        "title": "JobListResponse",
        "type": "object"
      },
      "JobResponse": {
        "additionalProperties": true,
        "properties": {
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "finished_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "default": "import",
            "enum": [
              "import",
              "review"
            ],
            "title": "Kind",
            "type": "string"
          },
          "phase": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phase"
          },
          "result": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Result"
          },
          "status": {
            "enum": [
              "pending",
              "running",
              "succeeded",
              "failed"
            ],
            "title": "Status",
            "type": "string"
          },
          "trace_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trace Id"
          },
          "workbook_id": {
            "title": "Workbook Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "workbook_id",
          "status"
        ],
        "title": "JobResponse",
        "type": "object"
      },
      "MaterializeRequest": {
        "properties": {
          "region_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Region Ids"
          },
          "target": {
            "$ref": "#/components/schemas/MaterializeTarget"
          }
        },
        "title": "MaterializeRequest",
        "type": "object"
      },
      "MaterializeResponse": {
        "additionalProperties": true,
        "properties": {
          "artifacts": {
            "default": [],
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Artifacts",
            "type": "array"
          }
        },
        "title": "MaterializeResponse",
        "type": "object"
      },
      "MaterializeTarget": {
        "properties": {
          "column_mapping": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Column Mapping"
          },
          "mode": {
            "default": "new",
            "enum": [
              "new",
              "append"
            ],
            "title": "Mode",
            "type": "string"
          },
          "table": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Table"
          }
        },
        "title": "MaterializeTarget",
        "type": "object"
      },
      "PaygEnableRequest": {
        "properties": {
          "account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id"
          }
        },
        "title": "PaygEnableRequest",
        "type": "object"
      },
      "Problem": {
        "description": "RFC7807-style error body. `suggested_fix` is written to be actionable for both humans and LLMs.",
        "properties": {
          "detail": {
            "type": "string"
          },
          "suggested_fix": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "enum": [
              "https://docs.d2b.dev/errors/conflict",
              "https://docs.d2b.dev/errors/forbidden",
              "https://docs.d2b.dev/errors/internal",
              "https://docs.d2b.dev/errors/propagation-failed",
              "https://docs.d2b.dev/errors/rate-limited",
              "https://docs.d2b.dev/errors/unauthorized",
              "https://docs.d2b.dev/errors/unknown-artifact",
              "https://docs.d2b.dev/errors/unknown-workbook",
              "https://docs.d2b.dev/errors/validation"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "ProvisionWorkspaceRequest": {
        "properties": {
          "account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "residency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Residency"
          }
        },
        "title": "ProvisionWorkspaceRequest",
        "type": "object"
      },
      "PutSheetRequest": {
        "properties": {
          "spec": {
            "$ref": "#/components/schemas/SheetSpec"
          }
        },
        "required": [
          "spec"
        ],
        "title": "PutSheetRequest",
        "type": "object"
      },
      "PutStyleRequest": {
        "properties": {
          "spec": {
            "$ref": "#/components/schemas/StyleSpec"
          }
        },
        "required": [
          "spec"
        ],
        "title": "PutStyleRequest",
        "type": "object"
      },
      "QueryRequest": {
        "properties": {
          "explain": {
            "default": false,
            "title": "Explain",
            "type": "boolean"
          },
          "limit": {
            "default": 1000,
            "maximum": 10000.0,
            "minimum": 1.0,
            "title": "Limit",
            "type": "integer"
          },
          "sql": {
            "title": "Sql",
            "type": "string"
          },
          "ttl_hours": {
            "default": 24,
            "title": "Ttl Hours",
            "type": "integer"
          }
        },
        "required": [
          "sql"
        ],
        "title": "QueryRequest",
        "type": "object"
      },
      "QueryResultResponse": {
        "additionalProperties": true,
        "properties": {
          "columns": {
            "anyOf": [
              {
                "items": {},
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Columns"
          },
          "masked_columns": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Masked Columns"
          },
          "result_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Result Id"
          },
          "row_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Row Count"
          },
          "rows": {
            "anyOf": [
              {
                "items": {
                  "items": {},
                  "type": "array"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rows"
          },
          "truncated": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Truncated"
          }
        },
        "title": "QueryResultResponse",
        "type": "object"
      },
      "Region": {
        "description": "One detected region within a Source (API/MCP spec v0.3 §1.3/§3) — the\nFile → N Tables fan-out point.\n\n``range`` is the Excel A1 core rectangle (``\"A6:F120\"``); ``None`` means\nthe region has no rectangle — a text-only decoration row (``text`` carries\nits content) or a whole-file region (flat CSV / parquet). ``sheet`` is the\nprovenance coordinate; CSV grids use the pseudo-sheet ``\"Sheet1\"``.\n\n``header`` overrides header detection at materialize time\n(``None`` = auto-detect). ``confidence`` is the detector's 0..1 score —\na deterministic heuristic, not a calibrated probability.",
        "properties": {
          "confidence": {
            "default": 1.0,
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Confidence",
            "type": "number"
          },
          "formulas": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Formulas"
          },
          "header": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Header"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "default": "data",
            "enum": [
              "data",
              "total",
              "metadata",
              "unknown"
            ],
            "title": "Kind",
            "type": "string"
          },
          "range": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Range"
          },
          "sheet": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sheet"
          },
          "text": {
            "items": {
              "type": "string"
            },
            "title": "Text",
            "type": "array"
          }
        },
        "required": [
          "id"
        ],
        "title": "Region",
        "type": "object"
      },
      "RenameTableRequest": {
        "properties": {
          "new_name": {
            "title": "New Name",
            "type": "string"
          }
        },
        "required": [
          "new_name"
        ],
        "title": "RenameTableRequest",
        "type": "object"
      },
      "ResolveConflictRequest": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "resolution": {
            "maxLength": 50,
            "minLength": 1,
            "title": "Resolution",
            "type": "string"
          }
        },
        "required": [
          "resolution"
        ],
        "title": "ResolveConflictRequest",
        "type": "object"
      },
      "ReuseCardRequest": {
        "properties": {
          "account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id"
          }
        },
        "title": "ReuseCardRequest",
        "type": "object"
      },
      "RevertResponse": {
        "additionalProperties": true,
        "properties": {
          "label": {
            "title": "Label",
            "type": "string"
          },
          "raw_errors": {
            "default": [],
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Raw Errors",
            "type": "array"
          },
          "raw_pinned": {
            "default": false,
            "title": "Raw Pinned",
            "type": "boolean"
          },
          "raw_rollbacks": {
            "default": [],
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Raw Rollbacks",
            "type": "array"
          },
          "restored_artifacts": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Restored Artifacts",
            "type": "array"
          },
          "snapshot_id": {
            "title": "Snapshot Id",
            "type": "integer"
          }
        },
        "required": [
          "label",
          "snapshot_id"
        ],
        "title": "RevertResponse",
        "type": "object"
      },
      "ReviewAcceptedResponse": {
        "additionalProperties": true,
        "description": "The review continues as a job: poll ``GET /api/v1/jobs/{job_id}``;\nits ``result`` is the :class:`ReviewResponse`.",
        "properties": {
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "kind": {
            "const": "review",
            "default": "review",
            "title": "Kind",
            "type": "string"
          },
          "mode": {
            "enum": [
              "lint",
              "agent"
            ],
            "title": "Mode",
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "running"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "job_id",
          "status",
          "mode"
        ],
        "title": "ReviewAcceptedResponse",
        "type": "object"
      },
      "ReviewCoverage": {
        "additionalProperties": true,
        "properties": {
          "examined": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Examined",
            "type": "array"
          },
          "skipped": {
            "default": [],
            "items": {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            "title": "Skipped",
            "type": "array"
          },
          "unsupported_formulas": {
            "default": 0,
            "title": "Unsupported Formulas",
            "type": "integer"
          }
        },
        "title": "ReviewCoverage",
        "type": "object"
      },
      "ReviewFinding": {
        "additionalProperties": true,
        "properties": {
          "confidence": {
            "title": "Confidence",
            "type": "number"
          },
          "evidence": {
            "additionalProperties": true,
            "default": {},
            "title": "Evidence",
            "type": "object"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "severity": {
            "enum": [
              "error",
              "warning",
              "info"
            ],
            "title": "Severity",
            "type": "string"
          },
          "source": {
            "enum": [
              "deterministic",
              "judgement",
              "agent"
            ],
            "title": "Source",
            "type": "string"
          },
          "status": {
            "enum": [
              "confirmed",
              "hypothesis",
              "unverified"
            ],
            "title": "Status",
            "type": "string"
          },
          "suggestion": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Suggestion"
          },
          "target": {
            "additionalProperties": true,
            "title": "Target",
            "type": "object"
          }
        },
        "required": [
          "kind",
          "severity",
          "message",
          "target",
          "source",
          "status",
          "confidence"
        ],
        "title": "ReviewFinding",
        "type": "object"
      },
      "ReviewRequest": {
        "additionalProperties": false,
        "properties": {
          "async": {
            "default": false,
            "description": "Answer with the job at once instead of waiting for a lint review.",
            "title": "Async",
            "type": "boolean"
          },
          "judge": {
            "default": true,
            "description": "lint: ask the judgement model whether each computed column's label matches its computation (billed). false uses no model and is free.",
            "title": "Judge",
            "type": "boolean"
          },
          "lang": {
            "default": "en",
            "description": "Language of the messages and the summary (en, ja, …).",
            "pattern": "^[A-Za-z]{2,3}([-_][A-Za-z0-9]{2,8})?$",
            "title": "Lang",
            "type": "string"
          },
          "mode": {
            "default": "lint",
            "description": "lint: the deterministic checks and the judgement model (seconds to a minute). agent: the review agent on top — explorers, verification of every candidate and a written summary (minutes; always answered with a job).",
            "enum": [
              "lint",
              "agent"
            ],
            "title": "Mode",
            "type": "string"
          },
          "target": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A table, view or report to review; omitted, the whole workbook.",
            "title": "Target"
          }
        },
        "title": "ReviewRequest",
        "type": "object"
      },
      "ReviewResponse": {
        "additionalProperties": true,
        "properties": {
          "counts": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Counts",
            "type": "object"
          },
          "coverage": {
            "$ref": "#/components/schemas/ReviewCoverage"
          },
          "credits": {
            "default": 0,
            "title": "Credits",
            "type": "integer"
          },
          "dropped": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dropped"
          },
          "elapsed_s": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Elapsed S"
          },
          "findings": {
            "items": {
              "$ref": "#/components/schemas/ReviewFinding"
            },
            "title": "Findings",
            "type": "array"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "target": {
            "additionalProperties": true,
            "title": "Target",
            "type": "object"
          },
          "usage": {
            "additionalProperties": {
              "type": "integer"
            },
            "default": {},
            "title": "Usage",
            "type": "object"
          }
        },
        "required": [
          "target",
          "findings",
          "coverage",
          "counts"
        ],
        "title": "ReviewResponse",
        "type": "object"
      },
      "ReviseRegion": {
        "properties": {
          "range": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Range"
          },
          "region_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Region Id"
          },
          "sheet": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sheet"
          }
        },
        "title": "ReviseRegion",
        "type": "object"
      },
      "ReviseRequest": {
        "properties": {
          "region": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ReviseRegion"
              },
              {
                "type": "null"
              }
            ]
          },
          "transform": {
            "$ref": "#/components/schemas/ReviseTransform"
          }
        },
        "required": [
          "transform"
        ],
        "title": "ReviseRequest",
        "type": "object"
      },
      "ReviseTransform": {
        "properties": {
          "args": {
            "additionalProperties": {
              "type": "string"
            },
            "default": {},
            "title": "Args",
            "type": "object"
          },
          "artifact_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Artifact Name"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "template": {
            "title": "Template",
            "type": "string"
          }
        },
        "required": [
          "name",
          "template"
        ],
        "title": "ReviseTransform",
        "type": "object"
      },
      "RowJsonSchemaResponse": {
        "additionalProperties": true,
        "properties": {
          "json_schema": {
            "additionalProperties": true,
            "title": "Json Schema",
            "type": "object"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "table_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Table Name"
          }
        },
        "required": [
          "name",
          "json_schema"
        ],
        "title": "RowJsonSchemaResponse",
        "type": "object"
      },
      "RowsPageResponse": {
        "additionalProperties": true,
        "properties": {
          "columns": {
            "items": {
              "$ref": "#/components/schemas/ColumnInfo"
            },
            "title": "Columns",
            "type": "array"
          },
          "denied_columns": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Denied Columns",
            "type": "array"
          },
          "edit_version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Edit Version"
          },
          "masked_columns": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Masked Columns",
            "type": "array"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "next_offset": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Offset"
          },
          "row_count": {
            "title": "Row Count",
            "type": "integer"
          },
          "rows": {
            "items": {
              "items": {},
              "type": "array"
            },
            "title": "Rows",
            "type": "array"
          },
          "table_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Table Name"
          }
        },
        "required": [
          "name",
          "columns",
          "rows",
          "row_count"
        ],
        "title": "RowsPageResponse",
        "type": "object"
      },
      "SetFormulaRequest": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "expr": {
            "maxLength": 500,
            "minLength": 1,
            "title": "Expr",
            "type": "string"
          }
        },
        "required": [
          "expr"
        ],
        "title": "SetFormulaRequest",
        "type": "object"
      },
      "SetPolicyRequest": {
        "properties": {
          "actor": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Actor",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "effect": {
            "maxLength": 20,
            "minLength": 1,
            "title": "Effect",
            "type": "string"
          },
          "role": {
            "default": "*",
            "maxLength": 64,
            "minLength": 1,
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "effect",
          "actor"
        ],
        "title": "SetPolicyRequest",
        "type": "object"
      },
      "SetRolesRequest": {
        "properties": {
          "roles": {
            "items": {
              "type": "string"
            },
            "maxItems": 32,
            "title": "Roles",
            "type": "array"
          }
        },
        "title": "SetRolesRequest",
        "type": "object"
      },
      "SheetListResponse": {
        "additionalProperties": true,
        "properties": {
          "sheets": {
            "items": {
              "$ref": "#/components/schemas/SheetResponse"
            },
            "title": "Sheets",
            "type": "array"
          }
        },
        "required": [
          "sheets"
        ],
        "title": "SheetListResponse",
        "type": "object"
      },
      "SheetResponse": {
        "additionalProperties": true,
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "spec": {
            "additionalProperties": true,
            "title": "Spec",
            "type": "object"
          }
        },
        "required": [
          "name",
          "spec"
        ],
        "title": "SheetResponse",
        "type": "object"
      },
      "SheetSpec": {
        "additionalProperties": false,
        "properties": {
          "blocks": {
            "items": {
              "discriminator": {
                "mapping": {
                  "heading": "#/components/schemas/HeadingBlock",
                  "spacer": "#/components/schemas/SpacerBlock",
                  "table_view": "#/components/schemas/TableViewBlock",
                  "text": "#/components/schemas/TextBlock"
                },
                "propertyName": "kind"
              },
              "oneOf": [
                {
                  "$ref": "#/components/schemas/HeadingBlock"
                },
                {
                  "$ref": "#/components/schemas/TextBlock"
                },
                {
                  "$ref": "#/components/schemas/TableViewBlock"
                },
                {
                  "$ref": "#/components/schemas/SpacerBlock"
                }
              ]
            },
            "maxItems": 50,
            "minItems": 1,
            "title": "Blocks",
            "type": "array"
          }
        },
        "required": [
          "blocks"
        ],
        "title": "SheetSpec",
        "type": "object"
      },
      "SourceInfo": {
        "additionalProperties": true,
        "properties": {
          "file_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "File Type"
          },
          "filename": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filename"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          }
        },
        "required": [
          "name"
        ],
        "title": "SourceInfo",
        "type": "object"
      },
      "SourcesListResponse": {
        "additionalProperties": true,
        "properties": {
          "sources": {
            "items": {
              "$ref": "#/components/schemas/SourceInfo"
            },
            "title": "Sources",
            "type": "array"
          }
        },
        "required": [
          "sources"
        ],
        "title": "SourcesListResponse",
        "type": "object"
      },
      "SpacerBlock": {
        "additionalProperties": false,
        "properties": {
          "kind": {
            "const": "spacer",
            "title": "Kind",
            "type": "string"
          },
          "rows": {
            "default": 1,
            "maximum": 20.0,
            "minimum": 1.0,
            "title": "Rows",
            "type": "integer"
          }
        },
        "required": [
          "kind"
        ],
        "title": "SpacerBlock",
        "type": "object"
      },
      "StyleAnnotation": {
        "additionalProperties": false,
        "properties": {
          "column": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Column",
            "type": "string"
          },
          "row_id": {
            "title": "Row Id",
            "type": "integer"
          },
          "style": {
            "$ref": "#/components/schemas/StyleProps"
          }
        },
        "required": [
          "row_id",
          "column",
          "style"
        ],
        "title": "StyleAnnotation",
        "type": "object"
      },
      "StyleProps": {
        "additionalProperties": false,
        "description": "The closed style vocabulary (v0.5 §5.3). Input-side strict:\nunknown keys are a caller bug → 422 with the field named.",
        "properties": {
          "align": {
            "anyOf": [
              {
                "enum": [
                  "left",
                  "center",
                  "right"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Align"
          },
          "bold": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bold"
          },
          "color": {
            "anyOf": [
              {
                "pattern": "^#[0-9A-Fa-f]{6}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Color"
          },
          "fill": {
            "anyOf": [
              {
                "pattern": "^#[0-9A-Fa-f]{6}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fill"
          },
          "italic": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Italic"
          },
          "number_format": {
            "anyOf": [
              {
                "maxLength": 50,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Number Format"
          },
          "underline": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Underline"
          }
        },
        "title": "StyleProps",
        "type": "object"
      },
      "StyleRule": {
        "additionalProperties": false,
        "properties": {
          "columns": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Columns"
          },
          "style": {
            "$ref": "#/components/schemas/StyleProps"
          },
          "when": {
            "description": "SQL predicate, re-evaluated at delivery",
            "maxLength": 500,
            "minLength": 1,
            "title": "When",
            "type": "string"
          }
        },
        "required": [
          "when",
          "style"
        ],
        "title": "StyleRule",
        "type": "object"
      },
      "StyleSpec": {
        "additionalProperties": false,
        "properties": {
          "borders": {
            "anyOf": [
              {
                "enum": [
                  "none",
                  "outer",
                  "grid"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Borders"
          },
          "column_widths": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "number"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Column name → width in Excel character units (1–255).",
            "title": "Column Widths"
          },
          "columns": {
            "anyOf": [
              {
                "additionalProperties": {
                  "$ref": "#/components/schemas/StyleProps"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Columns"
          },
          "freeze_header": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Freeze Header"
          },
          "header": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StyleProps"
              },
              {
                "type": "null"
              }
            ]
          },
          "rules": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/StyleRule"
                },
                "maxItems": 20,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rules"
          }
        },
        "title": "StyleSpec",
        "type": "object"
      },
      "StyleStateResponse": {
        "additionalProperties": true,
        "properties": {
          "annotations": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Annotations",
            "type": "array"
          },
          "spec": {
            "additionalProperties": true,
            "title": "Spec",
            "type": "object"
          }
        },
        "required": [
          "spec",
          "annotations"
        ],
        "title": "StyleStateResponse",
        "type": "object"
      },
      "TableSchemaResponse": {
        "additionalProperties": true,
        "properties": {
          "denied_columns": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Denied Columns",
            "type": "array"
          },
          "freshness": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Freshness"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "masked_columns": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Masked Columns",
            "type": "array"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "row_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Row Count"
          },
          "sample_rows": {
            "anyOf": [
              {
                "items": {
                  "items": {},
                  "type": "array"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Rows"
          },
          "schema": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Schema",
            "type": "array"
          },
          "table_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Table Name"
          },
          "type": {
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "name",
          "type",
          "schema"
        ],
        "title": "TableSchemaResponse",
        "type": "object"
      },
      "TableViewBlock": {
        "additionalProperties": false,
        "properties": {
          "kind": {
            "const": "table_view",
            "title": "Kind",
            "type": "string"
          },
          "table": {
            "minLength": 1,
            "title": "Table",
            "type": "string"
          },
          "title": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          },
          "totals": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/TotalSpec"
                },
                "maxItems": 50,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Totals"
          },
          "totals_label": {
            "anyOf": [
              {
                "maxLength": 100,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Totals Label"
          }
        },
        "required": [
          "kind",
          "table"
        ],
        "title": "TableViewBlock",
        "type": "object"
      },
      "TagColumnRequest": {
        "properties": {
          "actor": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Actor",
            "type": "string"
          },
          "tag": {
            "maxLength": 50,
            "minLength": 1,
            "title": "Tag",
            "type": "string"
          }
        },
        "required": [
          "tag",
          "actor"
        ],
        "title": "TagColumnRequest",
        "type": "object"
      },
      "TextBlock": {
        "additionalProperties": false,
        "properties": {
          "kind": {
            "const": "text",
            "title": "Kind",
            "type": "string"
          },
          "span": {
            "anyOf": [
              {
                "maximum": 50.0,
                "minimum": 2.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Span"
          },
          "style": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StyleProps"
              },
              {
                "type": "null"
              }
            ]
          },
          "text": {
            "minLength": 1,
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "text"
        ],
        "title": "TextBlock",
        "type": "object"
      },
      "TokenUsageDay": {
        "additionalProperties": true,
        "properties": {
          "day": {
            "title": "Day",
            "type": "string"
          },
          "errors": {
            "title": "Errors",
            "type": "integer"
          },
          "requests": {
            "title": "Requests",
            "type": "integer"
          },
          "token_id": {
            "title": "Token Id",
            "type": "string"
          }
        },
        "required": [
          "token_id",
          "day",
          "requests",
          "errors"
        ],
        "title": "TokenUsageDay",
        "type": "object"
      },
      "TotalSpec": {
        "additionalProperties": false,
        "properties": {
          "agg": {
            "enum": [
              "sum",
              "avg",
              "min",
              "max",
              "count"
            ],
            "title": "Agg",
            "type": "string"
          },
          "column": {
            "minLength": 1,
            "title": "Column",
            "type": "string"
          }
        },
        "required": [
          "column",
          "agg"
        ],
        "title": "TotalSpec",
        "type": "object"
      },
      "TrackFileRequest": {
        "properties": {
          "as_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Register the source under another name",
            "title": "As Name"
          },
          "filename": {
            "minLength": 1,
            "title": "Filename",
            "type": "string"
          },
          "item_id": {
            "description": "OneDrive / SharePoint drive item id of an xlsx",
            "minLength": 1,
            "title": "Item Id",
            "type": "string"
          },
          "on_existing": {
            "default": "auto",
            "description": "What an existing same-name source means: auto = seed v1 from D2B's copy when it looks like the same file, else refuse; seed / replace / refuse",
            "enum": [
              "auto",
              "seed",
              "replace",
              "refuse"
            ],
            "title": "On Existing",
            "type": "string"
          }
        },
        "required": [
          "item_id",
          "filename"
        ],
        "title": "TrackFileRequest",
        "type": "object"
      },
      "TransformInfo": {
        "additionalProperties": true,
        "description": "One transform → artifact edge, template included.\n\n``name`` is the transform label (free-form, ``agg/monthly`` style);\n``file`` is the content-addressed file the template is stored under\n(``{stem}_{sha256[:12]}.{sql|py}``) — a cheap change detector.",
        "properties": {
          "args": {
            "additionalProperties": {
              "type": "string"
            },
            "default": {},
            "title": "Args",
            "type": "object"
          },
          "artifact_name": {
            "title": "Artifact Name",
            "type": "string"
          },
          "file": {
            "title": "File",
            "type": "string"
          },
          "kind": {
            "enum": [
              "sql",
              "python"
            ],
            "title": "Kind",
            "type": "string"
          },
          "layer": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Layer"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "template": {
            "title": "Template",
            "type": "string"
          }
        },
        "required": [
          "name",
          "kind",
          "template",
          "artifact_name",
          "file"
        ],
        "title": "TransformInfo",
        "type": "object"
      },
      "TransformListResponse": {
        "additionalProperties": true,
        "properties": {
          "transforms": {
            "items": {
              "$ref": "#/components/schemas/TransformInfo"
            },
            "title": "Transforms",
            "type": "array"
          }
        },
        "required": [
          "transforms"
        ],
        "title": "TransformListResponse",
        "type": "object"
      },
      "TransformRequest": {
        "properties": {
          "args": {
            "additionalProperties": {
              "type": "string"
            },
            "default": {},
            "title": "Args",
            "type": "object"
          },
          "artifact_name": {
            "title": "Artifact Name",
            "type": "string"
          },
          "kind": {
            "enum": [
              "sql",
              "python"
            ],
            "title": "Kind",
            "type": "string"
          },
          "layer": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Layer"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "template": {
            "title": "Template",
            "type": "string"
          }
        },
        "required": [
          "name",
          "kind",
          "template",
          "artifact_name"
        ],
        "title": "TransformRequest",
        "type": "object"
      },
      "TransformResponse": {
        "additionalProperties": true,
        "properties": {
          "artifact": {
            "additionalProperties": true,
            "title": "Artifact",
            "type": "object"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "transform_name": {
            "title": "Transform Name",
            "type": "string"
          }
        },
        "required": [
          "artifact",
          "transform_name",
          "kind"
        ],
        "title": "TransformResponse",
        "type": "object"
      },
      "UndoRequest": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          }
        },
        "title": "UndoRequest",
        "type": "object"
      },
      "UpdateParseSpecRequest": {
        "properties": {
          "regions": {
            "items": {
              "$ref": "#/components/schemas/Region"
            },
            "minItems": 1,
            "title": "Regions",
            "type": "array"
          }
        },
        "required": [
          "regions"
        ],
        "title": "UpdateParseSpecRequest",
        "type": "object"
      },
      "UploadSlotRequest": {
        "properties": {
          "filename": {
            "maxLength": 255,
            "minLength": 1,
            "title": "Filename",
            "type": "string"
          },
          "mode": {
            "default": "auto",
            "enum": [
              "auto",
              "staged"
            ],
            "title": "Mode",
            "type": "string"
          }
        },
        "required": [
          "filename"
        ],
        "title": "UploadSlotRequest",
        "type": "object"
      },
      "UpsertRowsRequest": {
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "allow_override": {
            "default": false,
            "title": "Allow Override",
            "type": "boolean"
          },
          "expected_version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Version"
          },
          "rows": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "maxItems": 1000,
            "minItems": 1,
            "title": "Rows",
            "type": "array"
          }
        },
        "required": [
          "rows",
          "expected_version"
        ],
        "title": "UpsertRowsRequest",
        "type": "object"
      },
      "UpsertRowsResponse": {
        "additionalProperties": true,
        "properties": {
          "conflicts": {
            "default": [],
            "items": {
              "type": "integer"
            },
            "title": "Conflicts",
            "type": "array"
          },
          "inserted": {
            "title": "Inserted",
            "type": "integer"
          },
          "row_ids": {
            "default": [],
            "items": {
              "type": "integer"
            },
            "title": "Row Ids",
            "type": "array"
          },
          "table_name": {
            "title": "Table Name",
            "type": "string"
          },
          "updated": {
            "title": "Updated",
            "type": "integer"
          },
          "version": {
            "title": "Version",
            "type": "integer"
          }
        },
        "required": [
          "table_name",
          "version",
          "updated",
          "inserted"
        ],
        "title": "UpsertRowsResponse",
        "type": "object"
      },
      "UrlIngestRequest": {
        "properties": {
          "filename": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filename"
          },
          "mode": {
            "default": "auto",
            "enum": [
              "auto",
              "staged"
            ],
            "title": "Mode",
            "type": "string"
          },
          "url": {
            "maxLength": 2048,
            "minLength": 1,
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "UrlIngestRequest",
        "type": "object"
      },
      "UsageResponse": {
        "additionalProperties": true,
        "properties": {
          "days": {
            "title": "Days",
            "type": "integer"
          },
          "token_names": {
            "additionalProperties": {
              "type": "string"
            },
            "title": "Token Names",
            "type": "object"
          },
          "usage": {
            "items": {
              "$ref": "#/components/schemas/TokenUsageDay"
            },
            "title": "Usage",
            "type": "array"
          }
        },
        "required": [
          "days",
          "usage",
          "token_names"
        ],
        "title": "UsageResponse",
        "type": "object"
      },
      "ValidateRequest": {
        "properties": {
          "sql": {
            "title": "Sql",
            "type": "string"
          }
        },
        "required": [
          "sql"
        ],
        "title": "ValidateRequest",
        "type": "object"
      },
      "ValidateResponse": {
        "additionalProperties": true,
        "properties": {
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "estimated_rows": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimated Rows"
          },
          "valid": {
            "title": "Valid",
            "type": "boolean"
          }
        },
        "required": [
          "valid"
        ],
        "title": "ValidateResponse",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "ctx": {
            "title": "Context",
            "type": "object"
          },
          "input": {
            "title": "Input"
          },
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      },
      "VersionInfo": {
        "additionalProperties": true,
        "properties": {
          "actor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "snapshot_id": {
            "title": "Snapshot Id",
            "type": "integer"
          }
        },
        "required": [
          "label",
          "snapshot_id"
        ],
        "title": "VersionInfo",
        "type": "object"
      },
      "VersionListResponse": {
        "additionalProperties": true,
        "properties": {
          "versions": {
            "items": {
              "$ref": "#/components/schemas/VersionInfo"
            },
            "title": "Versions",
            "type": "array"
          }
        },
        "required": [
          "versions"
        ],
        "title": "VersionListResponse",
        "type": "object"
      },
      "app__api__v1__routes__ingest__CreateWorkbookRequest": {
        "properties": {
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          },
          "workspace_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Workspace Id"
          }
        },
        "title": "CreateWorkbookRequest",
        "type": "object"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Spreadsheets for AI Agents — typed, versioned, governed tables behind an agent-native API. Auth: Bearer PAT (data:read / data:write / data:admin) for /api/v1, Account API key (control:read / control:admin) for /api/control.",
    "title": "D2B API",
    "version": "v1"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/control/account": {
      "get": {
        "description": "One Account (``account_id`` picks among the caller's; default = the\noldest, lazily provisioned on first touch).",
        "operationId": "get_account_api_control_account_get",
        "parameters": [
          {
            "in": "query",
            "name": "account_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Account Id"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get Account Api Control Account Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Account",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/billing": {
      "get": {
        "operationId": "account_billing_api_control_account_billing_get",
        "parameters": [
          {
            "in": "query",
            "name": "account_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Account Id"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Account Billing Api Control Account Billing Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Account Billing",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/billing/auto-topup": {
      "patch": {
        "description": "Adjust (or switch off) the Account's low-balance auto-recharge.",
        "operationId": "account_billing_auto_topup_api_control_account_billing_auto_topup_patch",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountAutoTopupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Account Billing Auto Topup Api Control Account Billing Auto Topup Patch",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Account Billing Auto Topup",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/billing/checkout": {
      "post": {
        "description": "Start the Account's subscription (Solo / Pro, monthly or annual) —\nthe same Stripe prices the personal plan page sells.",
        "operationId": "account_billing_checkout_api_control_account_billing_checkout_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevCheckoutRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Account Billing Checkout Api Control Account Billing Checkout Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Account Billing Checkout",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/billing/payg": {
      "post": {
        "description": "Enable pay-as-you-go: a setup Checkout saves a card on the Account's\ncustomer (no charge); the webhook then flips the free tier to \"payg\"\nwith auto-recharge on. $0 monthly — you pay the pack rate for what you\nuse.",
        "operationId": "account_billing_payg_api_control_account_billing_payg_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaygEnableRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Account Billing Payg Api Control Account Billing Payg Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Account Billing Payg",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/billing/portal": {
      "post": {
        "operationId": "account_billing_portal_api_control_account_billing_portal_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevPortalRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Account Billing Portal Api Control Account Billing Portal Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Account Billing Portal",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/billing/reuse-card": {
      "post": {
        "description": "Reuse the card already registered on the owner's DEFAULT wallet for\na developer Account (2026-09-01 onboarding: developer accounts skip the\nFree presentation and register a card up front).\n\nStripe PaymentMethods can't hop between customers, so \"reuse\" means the\ndeveloper Account SHARES the default wallet's customer. Charges/\nsubscriptions stay attributable: everything we create carries\nmetadata.account_id, and lifecycle events resolve by subscription id\nbefore any customer lookup. Card on file → the account flips straight\nto usage billing (payg + auto-recharge), same end-state as the setup\nCheckout.",
        "operationId": "account_billing_reuse_card_api_control_account_billing_reuse_card_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReuseCardRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Account Billing Reuse Card Api Control Account Billing Reuse Card Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Account Billing Reuse Card",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/billing/topup": {
      "post": {
        "description": "Buy a prepaid credit pack — raises the Account's metering ceiling.",
        "operationId": "account_billing_topup_api_control_account_billing_topup_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevTopupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Account Billing Topup Api Control Account Billing Topup Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Account Billing Topup",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/delete": {
      "post": {
        "description": "Delete a developer Account and everything that dies with it.\n\nAllowed only when ALL of these hold (each violation is its own error):\n\n* the caller is the owner's session (JWT) — a key must not be able to\n  erase its own principal;\n* ``kind == \"developer\"`` — the default account IS the user's wallet;\n* no active/trialing subscription — cancel via the Stripe portal first\n  (no silent cancellation side effects);\n* no settleable overage — postpaid liability must be billed before the\n  debtor disappears. This counts the stored arrears bucket AND the\n  current period's derived ops overage (which the monthly settlement\n  would snapshot and charge), measured against the same floor\n  settlement uses: a balance too small for settlement to ever charge\n  is written off rather than trapping the account forever;\n* ``confirm`` matches the account name exactly.\n\nThe cascade, in order: revoke every API key pinned to the account\n(cutting off concurrent access first), delete each funded workspace and\nits workbook rows (same metadata-delete semantics as the app's workbook\ndeletion), then the account row. Remaining credits — period and pack —\nare forfeited: prepaid balances don't transfer between wallets (pack\nrates differ per tier; a transfer would be an arbitrage loop). The\nStripe customer is never touched: it may be shared with the default\nwallet (reuse-card), and its invoice history stays valuable either way.",
        "operationId": "delete_account_api_control_account_delete_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Delete Account Api Control Account Delete Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Account",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/keys": {
      "get": {
        "operationId": "list_account_keys_api_control_account_keys_get",
        "parameters": [
          {
            "in": "query",
            "name": "account_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Account Id"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response List Account Keys Api Control Account Keys Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Account Keys",
        "tags": [
          "control"
        ]
      },
      "post": {
        "description": "Mint an account API key. The plaintext is returned exactly once.\n\nA key minted WITH a key cannot exceed the issuer's scopes, nor reach\noutside the issuer's own resource (no privilege escalation through\nre-issuance, in either dimension); the owner's JWT mints anything.\n``workspace_id`` pins the key to that workspace (``resource=\n\"workspace:<id>\"``): its workbooks on the data plane, and that\nworkspace alone on the control plane.",
        "operationId": "create_account_key_api_control_account_keys_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Create Account Key Api Control Account Keys Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Account Key",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/keys/{key_id}": {
      "delete": {
        "description": "Revoke one of the account's API keys.\n\nReach follows the credential: the owner's session and account-scoped\nkeys manage every key on the account, a pinned key only keys pinned\nthe same way — plus itself, always, so a suspect credential can burn\nitself without holding authority over any other. The key listing\nshows exactly what this reaches.",
        "operationId": "revoke_account_key_api_control_account_keys__key_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "key_id",
            "required": true,
            "schema": {
              "title": "Key Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "account_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Account Id"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Revoke Account Key Api Control Account Keys  Key Id  Delete",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Revoke Account Key",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/account/usage/series": {
      "get": {
        "description": "Daily usage buckets for the console's trend charts.\n\nFlows (requests / ops / credits) are that day's totals; stocks\n(storage_bytes / tables) are the day's last sample and may be null on\ndays no sweep landed. Days with no activity are omitted — the client\nfills gaps (zeros for flows, carry-forward for stocks).",
        "operationId": "account_usage_series_api_control_account_usage_series_get",
        "parameters": [
          {
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "title": "Days",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "account_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Account Id"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Account Usage Series Api Control Account Usage Series Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Account Usage Series",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/accounts": {
      "get": {
        "description": "Every Account the caller owns (User:Account = 1:N — the paved road is\none Account per service). Account keys see only their own account.\n\n2026-09-01 unification: the DEFAULT account (the wallet the app bills)\nis the console's first-class account too — no lazy developer twin is\nminted any more. The listing is [default, ...explicit developer\naccounts]; ``provision`` is accepted for compatibility but inert (the\ndefault account is app-plane and materializes on first billing touch\nregardless of who asks).",
        "operationId": "list_accounts_api_control_accounts_get",
        "parameters": [
          {
            "in": "query",
            "name": "provision",
            "required": false,
            "schema": {
              "default": true,
              "title": "Provision",
              "type": "boolean"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response List Accounts Api Control Accounts Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Accounts",
        "tags": [
          "control"
        ]
      },
      "post": {
        "description": "Create another Account — \"a new service = a new payment/contract\nsubject\". Owner JWT only: an account KEY must not mint sibling payment\nsubjects (its blast radius is its own account).",
        "operationId": "create_account_api_control_accounts_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Create Account Api Control Accounts Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Account",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/workspaces": {
      "get": {
        "operationId": "list_workspaces_api_control_workspaces_get",
        "parameters": [
          {
            "in": "query",
            "name": "account_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Account Id"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response List Workspaces Api Control Workspaces Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Workspaces",
        "tags": [
          "control"
        ]
      },
      "post": {
        "description": "workspace.provision — create an API-managed workspace under the account.\n\nUnlike the SPA's ``POST /api/workspaces`` this does NOT move the owner's\nactive SPA workspace (``user.workspace_id`` stays untouched): a provisioned\nworkspace is a workspace the developer backend manages, not a switch of\nthe human owner's working context. ``residency`` is recorded as a\ndeclaration; physical region enforcement is deferred (design doc §6).\n\nNeeds an account-scoped credential (or the owner's session): a key\npinned to one workspace does not create siblings for the account, the\nsame way an account key cannot create sibling accounts.",
        "operationId": "provision_workspace_api_control_workspaces_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProvisionWorkspaceRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Provision Workspace Api Control Workspaces Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Provision Workspace",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/workspaces/{workspace_id}": {
      "delete": {
        "description": "workspace.delete — remove an EMPTY managed workspace from the account.\n\nRefused while workbooks remain (delete those first with a workbooks:delete\ncredential) and for the built-in personal workspace. Keys pinned to\nthe workspace are revoked as part of the deletion.",
        "operationId": "delete_workspace_api_control_workspaces__workspace_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Delete Workspace Api Control Workspaces  Workspace Id  Delete",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Workspace",
        "tags": [
          "control"
        ]
      },
      "get": {
        "operationId": "get_workspace_api_control_workspaces__workspace_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get Workspace Api Control Workspaces  Workspace Id  Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Workspace",
        "tags": [
          "control"
        ]
      },
      "patch": {
        "description": "workspace.configure — apply the provided fields, leave the rest.\n\n``idp_config`` is stored as declared linkage only; user/role sync\nfrom the IdP is deferred until a customer IdP exists (design doc §6).",
        "operationId": "configure_workspace_api_control_workspaces__workspace_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfigureWorkspaceRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Configure Workspace Api Control Workspaces  Workspace Id  Patch",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Configure Workspace",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/workspaces/{workspace_id}/users": {
      "get": {
        "description": "users.list — the workspace's members with their EFFECTIVE roles\n(base role ∪ custom ABAC roles; the policy engine's subject).",
        "operationId": "list_workspace_users_api_control_workspaces__workspace_id__users_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response List Workspace Users Api Control Workspaces  Workspace Id  Users Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Workspace Users",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/workspaces/{workspace_id}/users/{user_id}/roles": {
      "put": {
        "description": "Assign custom ABAC roles to a member (replaces the custom set; the\nbase ``admin`` / ``editor`` / ``viewer`` role is membership state and\nstays). Built-in role names are reserved.",
        "operationId": "set_user_roles_api_control_workspaces__workspace_id__users__user_id__roles_put",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetRolesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Set User Roles Api Control Workspaces  Workspace Id  Users  User Id  Roles Put",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set User Roles",
        "tags": [
          "control"
        ]
      }
    },
    "/api/control/workspaces/{workspace_id}/workbooks": {
      "get": {
        "description": "Read-only observability (2026-09-01): the workbooks living in one\nfunded workspace, for the console's data view. Visibility-filtered —\nthe caller's own workbooks plus the ones shared with them, the same\nrule the app applies, so another member's private workbook is never\nlisted. Metadata only — table listings and row previews go through the\nv1 data endpoints, which the owner's session already passes.",
        "operationId": "list_workspace_workbooks_api_control_workspaces__workspace_id__workbooks_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response List Workspace Workbooks Api Control Workspaces  Workspace Id  Workbooks Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Workspace Workbooks",
        "tags": [
          "control"
        ]
      }
    },
    "/api/v1/cloud-files/{provider}": {
      "get": {
        "description": "Importable files on the caller's linked drive. Folders are listed\nfirst for navigation (``isFolder``); pass their ``id`` as ``folder_id``.\nSharePoint also searches by name with ``q``.",
        "operationId": "list_cloud_files_api_v1_cloud_files__provider__get",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "enum": [
                "sharepoint",
                "google_drive"
              ],
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "folder_id",
            "required": false,
            "schema": {
              "default": "root",
              "title": "Folder Id",
              "type": "string"
            }
          },
          {
            "description": "Name search (SharePoint only)",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Name search (SharePoint only)",
              "title": "Q"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Cloud Files",
        "tags": [
          "v1",
          "cloud-files"
        ]
      }
    },
    "/api/v1/jobs": {
      "get": {
        "description": "Recent async jobs for the calling user, newest first.\n\nSame registry as ``GET /jobs/{id}``: process-local, ~1h retention\nafter completion — a recent-activity view, not durable history. A\nworkbook-scoped credential sees only its workbook's jobs.",
        "operationId": "list_jobs_api_v1_jobs_get",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Jobs",
        "tags": [
          "v1",
          "jobs"
        ]
      }
    },
    "/api/v1/jobs/{job_id}": {
      "get": {
        "description": "Status + terminal result of an async operation.\n\n``status`` is one of ``pending | running | succeeded | failed``.\n``result`` (on success) carries the same body the synchronous form\nwould have returned; ``error`` (on failure) a short message.",
        "operationId": "get_job_api_v1_jobs__job_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Job",
        "tags": [
          "v1",
          "jobs"
        ]
      }
    },
    "/api/v1/me": {
      "get": {
        "description": "Identity + plan summary. Mirrors the SPA's ``/api/auth/me`` but\nadds the credential context — an agent inspecting ``principal``\nlearns *which* PAT it is and what scopes it carries.\n\nPrincipal-aware (DX report 4 §5-1/§5-3): an account-pinned key sees\nITS account's wallet and reach — ``plan``/``credits_*`` are the pinned\naccount's buckets and ``workspace_id`` is the oldest workspace that\naccount funds (null when it has none). The old behavior showed the\nowner's app-side wallet and personal-workspace pointer, which the\ncredential could not necessarily spend from or reach.",
        "operationId": "get_me_api_v1_me_get",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Me",
        "tags": [
          "v1",
          "me"
        ]
      }
    },
    "/api/v1/me/authorize/{provider}": {
      "get": {
        "description": "Whether D2B may read the caller's drive, and the one-page URL to\nauthorize it when not: the user opens it in a browser once (Microsoft:\nconnect the account; Google: connect and pick the files), then the\nagent retries its call.",
        "operationId": "cloud_authorization_api_v1_me_authorize__provider__get",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "enum": [
                "sharepoint",
                "google_drive"
              ],
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "workbook_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Workbook Id"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Cloud Authorization",
        "tags": [
          "v1",
          "cloud-files"
        ]
      }
    },
    "/api/v1/me/data": {
      "get": {
        "description": "List every artifact this credential can see, across every\nworkbook. Refreshes the catalog from DuckDB before serving so\nthe result reflects the current state of each workbook's session DB.\n\nThe response shape matches the proposal's §5 example: each row\ncarries enough metadata (schema, row_count, source files,\nupdated_at) for an agent to decide whether to drill down via\n``GET /workbooks/{cid}/artifacts/{name}/...``.",
        "operationId": "get_my_data_api_v1_me_data_get",
        "parameters": [
          {
            "description": "Opaque cursor from a prior call.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Opaque cursor from a prior call.",
              "title": "Cursor"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get My Data",
        "tags": [
          "v1",
          "data"
        ]
      }
    },
    "/api/v1/me/tokens": {
      "get": {
        "description": "List the calling user's PATs. Plaintext is never present —\nthe response is the redacted ``to_api`` form.",
        "operationId": "list_access_tokens_endpoint_api_v1_me_tokens_get",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Access Tokens Endpoint",
        "tags": [
          "v1",
          "me"
        ]
      },
      "post": {
        "description": "Mint a new PAT. The plaintext is returned exactly once.\n\nAll scopes default to ``workbooks:read`` so an accidental click in the\nUI can't issue a write-capable token without explicit intent.",
        "operationId": "create_access_token_endpoint_api_v1_me_tokens_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTokenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Access Token Endpoint",
        "tags": [
          "v1",
          "me"
        ]
      }
    },
    "/api/v1/me/tokens/{token_id}": {
      "delete": {
        "description": "Revoke a PAT. Idempotent — already-revoked tokens still return 204.\n\nReach follows the credential: the owner's session and account-scoped\nkeys manage every key on the account, a pinned key only keys pinned\nthe same way — plus itself, always, so a suspect credential can burn\nitself without holding authority over any other.",
        "operationId": "revoke_access_token_endpoint_api_v1_me_tokens__token_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "token_id",
            "required": true,
            "schema": {
              "title": "Token Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Revoke Access Token Endpoint",
        "tags": [
          "v1",
          "me"
        ]
      }
    },
    "/api/v1/me/usage": {
      "get": {
        "description": "Per-token daily request counts (trailing ``days``, UTC days),\naggregated from the token audit log. Same management gate as the\ntoken list — usage reveals which credentials exist and how hot\nthey run.",
        "operationId": "token_usage_api_v1_me_usage_get",
        "parameters": [
          {
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "maximum": 90,
              "minimum": 1,
              "title": "Days",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Token Usage",
        "tags": [
          "v1",
          "me"
        ]
      }
    },
    "/api/v1/me/webhooks": {
      "get": {
        "operationId": "list_webhooks_api_v1_me_webhooks_get",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Webhooks",
        "tags": [
          "v1",
          "webhooks"
        ]
      },
      "post": {
        "description": "Create a webhook subscription. Returns the signing secret once.\n\nThe owner is the calling user. Subscriptions are personal — there\nis no workspace-wide webhook in Phase 3; that lands with the wider workspace\nrollout in Phase 4.",
        "operationId": "create_webhook_api_v1_me_webhooks_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Webhook",
        "tags": [
          "v1",
          "webhooks"
        ]
      }
    },
    "/api/v1/me/webhooks/{webhook_id}": {
      "delete": {
        "operationId": "delete_webhook_endpoint_api_v1_me_webhooks__webhook_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "webhook_id",
            "required": true,
            "schema": {
              "title": "Webhook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Webhook Endpoint",
        "tags": [
          "v1",
          "webhooks"
        ]
      }
    },
    "/api/v1/me/webhooks/{webhook_id}/deliveries": {
      "get": {
        "description": "Recent deliveries for one webhook. Useful for debugging\n\"why isn't my endpoint receiving anything\" — surfaces attempt\ncount, last status, last error.",
        "operationId": "list_deliveries_api_v1_me_webhooks__webhook_id__deliveries_get",
        "parameters": [
          {
            "in": "path",
            "name": "webhook_id",
            "required": true,
            "schema": {
              "title": "Webhook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Deliveries",
        "tags": [
          "v1",
          "webhooks"
        ]
      }
    },
    "/api/v1/me/workbooks": {
      "get": {
        "description": "Paginated list of workbooks owned by the calling user.\n\nFor now this is straight enumeration from the store — no\nworkspace-shared rows, no shared-with-me rows. Those become relevant in\nPhase 3 when the catalog grows; today the agent's mental model is\n\"I see the data I personally own\".\n\nA ``workspace_id`` the credential cannot address is a 403, not an\nempty page: an empty page means \"you own nothing there\", and a\nworkspace outside the credential's reach must not read the same way.",
        "operationId": "list_my_workbooks_api_v1_me_workbooks_get",
        "parameters": [
          {
            "description": "Opaque pagination cursor returned by a prior call.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Opaque pagination cursor returned by a prior call.",
              "title": "Cursor"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Scope the listing to one workspace (a workspace id, or the self-relative alias 'personal' for the caller's personal workspace) — the collection rule: collections take an explicit scope, resource-addressed calls scope themselves.",
            "in": "query",
            "name": "workspace_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Scope the listing to one workspace (a workspace id, or the self-relative alias 'personal' for the caller's personal workspace) — the collection rule: collections take an explicit scope, resource-addressed calls scope themselves.",
              "title": "Workspace Id"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List My Workbooks",
        "tags": [
          "v1",
          "me"
        ]
      }
    },
    "/api/v1/me/workspaces": {
      "get": {
        "description": "The workspaces this credential can create in or read from, by name.\n\n``is_default`` marks where ``POST /workbooks`` lands when\n``workspace_id`` is omitted. Scoped to the credential's reach: an\naccount key lists its account's workspaces the owner belongs to, a\n``workspace:<id>`` key lists that one, a ``workbook:<id>`` key the\nworkbook's home.",
        "operationId": "list_my_workspaces_api_v1_me_workspaces_get",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List My Workspaces",
        "tags": [
          "v1",
          "me"
        ]
      }
    },
    "/api/v1/results/{result_id}": {
      "get": {
        "description": "Read a materialised result by id. Supports JSON, NDJSON, Arrow.",
        "operationId": "get_result_api_v1_results__result_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "result_id",
            "required": true,
            "schema": {
              "title": "Result Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 1000,
              "maximum": 10000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "accept",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Accept"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Result",
        "tags": [
          "v1",
          "query"
        ]
      }
    },
    "/api/v1/search": {
      "get": {
        "description": "Search across the user's artifacts by name, description, column\nnames, and source filenames.\n\nEmpty / whitespace-only queries return an empty result list instead\nof 400 — agents driving a partially-typed search box should not see\nerror noise on every keystroke. Real failures (FTS5 syntax issues)\nare filtered at the store layer.",
        "operationId": "search_api_v1_search_get",
        "parameters": [
          {
            "description": "Free-form keyword query.",
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "description": "Free-form keyword query.",
              "minLength": 1,
              "title": "Q",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Search",
        "tags": [
          "v1",
          "search"
        ]
      }
    },
    "/api/v1/uploads/{upload_id}": {
      "get": {
        "description": "Slot status: ``pending`` (waiting for bytes; ``upload_url`` is\nincluded), ``uploaded`` (ready to ingest) or ``ingested``.",
        "operationId": "get_upload_slot_api_v1_uploads__upload_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "upload_id",
            "required": true,
            "schema": {
              "title": "Upload Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get Upload Slot Api V1 Uploads  Upload Id  Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Upload Slot",
        "tags": [
          "v1",
          "uploads"
        ]
      },
      "put": {
        "description": "Receive the file for a slot. Authenticated by the signature in the\nURL alone (so a browser or a plain ``curl -T`` can send it); the body\nis the raw bytes.",
        "operationId": "put_upload_bytes_api_v1_uploads__upload_id__put",
        "parameters": [
          {
            "in": "path",
            "name": "upload_id",
            "required": true,
            "schema": {
              "title": "Upload Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "expires",
            "required": true,
            "schema": {
              "title": "Expires",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "sig",
            "required": true,
            "schema": {
              "maxLength": 40,
              "minLength": 40,
              "title": "Sig",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Put Upload Bytes Api V1 Uploads  Upload Id  Put",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Put Upload Bytes",
        "tags": [
          "v1",
          "uploads"
        ]
      }
    },
    "/api/v1/workbooks": {
      "post": {
        "description": "Create a fresh workbook owned by the calling user (see\n:func:`create_workbook_for_principal` for the scope contract).",
        "operationId": "create_workbook_api_v1_workbooks_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/app__api__v1__routes__ingest__CreateWorkbookRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Workbook",
        "tags": [
          "v1",
          "ingest"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}": {
      "delete": {
        "description": "workbook.delete — owner-only, same semantics as the SPA's delete.\nWithout it the CLI could create workbooks but never clean them up\n(DX report §5).",
        "operationId": "delete_workbook_api_v1_workbooks__workbook_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Workbook",
        "tags": [
          "v1",
          "ingest"
        ]
      },
      "get": {
        "description": "Workbook metadata. Drops the full message history — agents\nthat need it should pull from ``/api/workbooks/{id}`` for now\n(Phase 3 adds a dedicated `/messages` endpoint with windowing).",
        "operationId": "get_workbook_api_v1_workbooks__workbook_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Workbook",
        "tags": [
          "v1",
          "data"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/artifacts/{name}/columns": {
      "post": {
        "description": "Add a column to an editable table (all NULL, or ``default``\neverywhere). The column lands before ``__d2b_row_id`` so the row-id\nkeeps riding last. Type from the create-table allow-list.",
        "operationId": "add_column_api_v1_workbooks__workbook_id__artifacts__name__columns_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddColumnRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ColumnsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Add Column",
        "tags": [
          "v1",
          "columns"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/artifacts/{name}/columns/{column}": {
      "delete": {
        "description": "Drop a column from an editable table. The last data column can't\nbe dropped (delete the table instead). Any classification on the\ncolumn is removed.",
        "operationId": "drop_column_api_v1_workbooks__workbook_id__artifacts__name__columns__column__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "actor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor"
            }
          },
          {
            "in": "query",
            "name": "expected_version",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Expected Version"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ColumnsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Drop Column",
        "tags": [
          "v1",
          "columns"
        ]
      },
      "patch": {
        "description": "Rename (``new_name``) OR retype (``type``) one column — exactly\none per call. Retype casts existing values; a value that can't cast\ncleanly is a 400 (clean the data or use a SQL transform).",
        "operationId": "alter_column_api_v1_workbooks__workbook_id__artifacts__name__columns__column__patch",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlterColumnRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ColumnsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Alter Column",
        "tags": [
          "v1",
          "columns"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/artifacts/{name}/columns/{column}/tags": {
      "post": {
        "description": "Attach a sensitivity tag (``pii`` / ``hr`` / …) to a column.",
        "operationId": "tag_column_api_v1_workbooks__workbook_id__artifacts__name__columns__column__tags_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TagColumnRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Tag Column",
        "tags": [
          "v1",
          "governance"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/artifacts/{name}/columns/{column}/tags/{tag}": {
      "delete": {
        "description": "Remove a column's tag (its policies stop applying to this column).",
        "operationId": "untag_column_api_v1_workbooks__workbook_id__artifacts__name__columns__column__tags__tag__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "tag",
            "required": true,
            "schema": {
              "title": "Tag",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "actor",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "title": "Actor",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Untag Column",
        "tags": [
          "v1",
          "governance"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/artifacts/{name}/schema": {
      "get": {
        "description": "Schema-only response: columns + types + row count.\n\nCarries a 5-row sample so an agent can take a quick look without\ntriggering a paginated rows call.",
        "operationId": "get_artifact_schema_api_v1_workbooks__workbook_id__artifacts__name__schema_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "default": "columns",
              "pattern": "^(columns|json-schema)$",
              "title": "Format",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/TableSchemaResponse"
                    },
                    {
                      "$ref": "#/components/schemas/RowJsonSchemaResponse"
                    }
                  ],
                  "title": "Response Get Artifact Schema Api V1 Workbooks  Workbook Id  Artifacts  Name  Schema Get"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Artifact Schema",
        "tags": [
          "v1",
          "data"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/artifacts/{name}/sync-bindings": {
      "post": {
        "description": "Store the table ↔ external-sheet mapping (inert — D2B never\nexecutes the sync). One sheet maps to one table; binding a governed\ntable returns explicit warnings instead of silently leaking.",
        "operationId": "bind_sync_api_v1_workbooks__workbook_id__artifacts__name__sync_bindings_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BindRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Bind Sync",
        "tags": [
          "v1",
          "deliver"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/audit-log": {
      "get": {
        "description": "The access-audit chain (newest first) + a fresh integrity check.\n``chain_valid=false`` means an entry was altered, removed, or\nreordered after the fact.",
        "operationId": "get_audit_log_api_v1_workbooks__workbook_id__audit_log_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 200,
              "maximum": 1000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Audit Log",
        "tags": [
          "v1",
          "governance"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/branches": {
      "get": {
        "description": "Open branch points (one row per branched table): what an edited\nexport can still merge back against.",
        "operationId": "list_branches_api_v1_workbooks__workbook_id__branches_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 200,
              "maximum": 1000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Branches",
        "tags": [
          "v1",
          "deliver"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/charts": {
      "get": {
        "description": "Every chart in the workbook with its rendered ``config`` and the\n``recipe`` (tool + params) it was generated from.\n\nRead-only: charts are re-generated from their recipe, never edited as\nraw config, so this is history/inspection — what ``d2b pull`` writes\nto ``charts/*.json``. On a governed workbook (any column policy) the\n``config`` is omitted (``config_omitted=\"governed\"``): a chart embeds\nthe values it plots, which would bypass masking.",
        "operationId": "list_charts_api_v1_workbooks__workbook_id__charts_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChartListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Charts",
        "tags": [
          "v1",
          "charts"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/classifications": {
      "get": {
        "description": "Every column tag in the workbook (the targets policies bind to).",
        "operationId": "list_classifications_api_v1_workbooks__workbook_id__classifications_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 500,
              "maximum": 1000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Classifications",
        "tags": [
          "v1",
          "governance"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/conflicts": {
      "get": {
        "description": "The workbook's review queue. ``?status=open`` filters to the items\nstill awaiting a decision.",
        "operationId": "list_conflicts_api_v1_workbooks__workbook_id__conflicts_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 200,
              "maximum": 1000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Conflicts",
        "tags": [
          "v1",
          "rows"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/conflicts/{conflict_id}/resolve": {
      "post": {
        "description": "Close a review-queue item.\n\n``acknowledge`` records the decision; ``revert`` (overwrite\nconflicts) writes the prior value back as a fresh attributed edit;\n``drop_override`` (stale_override conflicts) removes the override so\nthe recomputed value shows.",
        "operationId": "resolve_conflict_api_v1_workbooks__workbook_id__conflicts__conflict_id__resolve_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "conflict_id",
            "required": true,
            "schema": {
              "title": "Conflict Id",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveConflictRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Resolve Conflict",
        "tags": [
          "v1",
          "rows"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/export": {
      "post": {
        "description": "Deliver tables as a file (xlsx: one sheet per table; csv: one\nfile, or a zip for several tables).\n\n``formula_mode=\"preserve\"`` (xlsx only) restores formula-provenance\ncolumns as live formulas translated to the file's coordinates — the\n``X-D2B-Preserved-Formulas`` header says which columns recalculate.\n``generate`` needs the reference-map layer and is still refused\nexplicitly. ``include_row_ids=True`` carries ``__d2b_row_id`` along\n(hidden column in xlsx) so an edited file can be merged back by row\nidentity later; ``record_branch=True`` additionally freezes the\nexported rows as the merge base (export = branch). Masking/deny\npolicies apply to the produced bytes; the ``X-D2B-Masked-Columns`` /\n``X-D2B-Denied-Columns`` headers say what was enforced.",
        "operationId": "export_workbook_api_v1_workbooks__workbook_id__export_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExportRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Export Workbook",
        "tags": [
          "v1",
          "deliver"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/file-links": {
      "get": {
        "description": "The workbook's tracked OneDrive / SharePoint files with their\nversions (newest last): ``n``, ``kind`` (link / sync / revert),\n``modified_by``, ``modified``, ``synced_at``, ``snapshot_id``.",
        "operationId": "list_file_links_api_v1_workbooks__workbook_id__file_links_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List File Links",
        "tags": [
          "v1",
          "file-links"
        ]
      },
      "post": {
        "description": "Put an xlsx on OneDrive / SharePoint under D2B version control: its\ncurrent bytes become version 1 and feed a workbook source of the same\nname; every later save becomes a version (see ``GET .../file-links``).",
        "operationId": "track_cloud_file_api_v1_workbooks__workbook_id__file_links_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrackFileRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Track Cloud File",
        "tags": [
          "v1",
          "cloud-files"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/file-links/local": {
      "post": {
        "description": "Track a file that lives on the user's machine (``d2b watch``): the\nuploaded bytes become version 1 and feed a source of the same name;\nthe client pushes later changes to ``…/file-links/{id}/versions``.\nNo drive API, no polling — the machine is the detector.\n\nIf the workbook already holds a source of that name: ``on_existing=auto``\nkeeps D2B's copy as v1 when it looks like the same file (a sheet in\ncommon) and refuses otherwise; ``as_name`` tracks under another name;\n``replace`` overwrites D2B's copy; ``seed`` forces the v1 seed.",
        "operationId": "track_local_file_api_v1_workbooks__workbook_id__file_links_local_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_track_local_file_api_v1_workbooks__workbook_id__file_links_local_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Track Local File",
        "tags": [
          "v1",
          "file-links"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/file-links/{link_id}/sync": {
      "post": {
        "description": "Pull the drive's copy now (even when its eTag did not move). A\nchanged file becomes a new version and re-ingests the source.\n\nRequires the ``workbooks:write`` and ``cloud-files:read`` scopes and\nedit rights on the workbook.",
        "operationId": "sync_file_link_api_v1_workbooks__workbook_id__file_links__link_id__sync_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "link_id",
            "required": true,
            "schema": {
              "title": "Link Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Sync File Link",
        "tags": [
          "v1",
          "file-links"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/file-links/{link_id}/versions": {
      "post": {
        "description": "Push the file's current bytes as the next version (``d2b watch``\ndoes this on every change). Identical bytes cut no version\n(``changed: false``).",
        "operationId": "push_file_link_version_api_v1_workbooks__workbook_id__file_links__link_id__versions_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "link_id",
            "required": true,
            "schema": {
              "title": "Link Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_push_file_link_version_api_v1_workbooks__workbook_id__file_links__link_id__versions_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Push File Link Version",
        "tags": [
          "v1",
          "file-links"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/file-links/{link_id}/versions/{n}/cells": {
      "get": {
        "description": "A version's sheet as ``{cell, value}`` pairs (values only) — what an\nagent needs to write that version back into the spreadsheet itself.\n\nRefused on governed workbooks because raw cell values cannot enforce\ncolumn policies.",
        "operationId": "file_link_version_cells_api_v1_workbooks__workbook_id__file_links__link_id__versions__n__cells_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "link_id",
            "required": true,
            "schema": {
              "title": "Link Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "n",
            "required": true,
            "schema": {
              "title": "N",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "sheet",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Sheet"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "File Link Version Cells",
        "tags": [
          "v1",
          "file-links"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/file-links/{link_id}/versions/{n}/diff": {
      "get": {
        "description": "Cell-by-cell diff from ``against`` (default: the previous version)\nto ``n``: per sheet, ``{cell, old, new}`` (values only, capped).\n\nRefused on governed workbooks because raw values cannot enforce column\npolicies.",
        "operationId": "diff_file_link_version_api_v1_workbooks__workbook_id__file_links__link_id__versions__n__diff_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "link_id",
            "required": true,
            "schema": {
              "title": "Link Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "n",
            "required": true,
            "schema": {
              "title": "N",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "against",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Against"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Diff File Link Version",
        "tags": [
          "v1",
          "file-links"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/file-links/{link_id}/versions/{n}/download": {
      "get": {
        "description": "The version's original xlsx bytes.\n\nRefused on governed workbooks because raw files cannot enforce column\npolicies.",
        "operationId": "download_file_link_version_api_v1_workbooks__workbook_id__file_links__link_id__versions__n__download_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "link_id",
            "required": true,
            "schema": {
              "title": "Link Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "n",
            "required": true,
            "schema": {
              "title": "N",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Download File Link Version",
        "tags": [
          "v1",
          "file-links"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/file-links/{link_id}/versions/{n}/revert": {
      "post": {
        "description": "Re-ingest version ``n`` on D2B's side as a new version. The file on\nthe drive is untouched — use ``cells`` (or ``download``) to put the\nvalues back into the spreadsheet yourself.",
        "operationId": "revert_file_link_version_api_v1_workbooks__workbook_id__file_links__link_id__versions__n__revert_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "link_id",
            "required": true,
            "schema": {
              "title": "Link Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "n",
            "required": true,
            "schema": {
              "title": "N",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Revert File Link Version",
        "tags": [
          "v1",
          "file-links"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/ops": {
      "get": {
        "description": "The workbook's ordered mutation history, newest first.\n\nEach op carries ``kind`` (rows.upsert / transform.run / formula.set /\nversion.commit / rows.undo …), ``actor`` attribution, a replayable\n``code`` reference, and ``undoable`` (true when this surface can apply\nits inverse via the undo endpoint).",
        "operationId": "list_ops_api_v1_workbooks__workbook_id__ops_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Page: only ops with op_id < before.",
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Page: only ops with op_id < before.",
              "title": "Before"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Ops",
        "tags": [
          "v1",
          "ops"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/ops/{op_id}/undo": {
      "post": {
        "description": "Undo one row op (rows.upsert / rows.delete) by applying its inverse.\n\nThe undo is itself a normal write: it bumps the table version, lands\nin the edit log with attribution, marks downstream artifacts stale\n(auto-recompute settles them) and records a ``rows.undo`` op. An op\ncan be undone once; undoing the undo is just another undo, targeting\nthe ``rows.undo`` op's own recorded edits.",
        "operationId": "undo_op_api_v1_workbooks__workbook_id__ops__op_id__undo_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "op_id",
            "required": true,
            "schema": {
              "title": "Op Id",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UndoRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Undo Op",
        "tags": [
          "v1",
          "ops"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/policies": {
      "get": {
        "description": "The workbook's tag→effect rules.",
        "operationId": "list_policies_api_v1_workbooks__workbook_id__policies_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 500,
              "maximum": 1000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Policies",
        "tags": [
          "v1",
          "governance"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/policies/{tag}": {
      "delete": {
        "description": "Drop a tag's rules (the tag itself stays on the columns).\n``?role=`` removes just that role's row; without it the tag stops\nbeing governed entirely.",
        "operationId": "delete_policy_api_v1_workbooks__workbook_id__policies__tag__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "tag",
            "required": true,
            "schema": {
              "title": "Tag",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "actor",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "title": "Actor",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "role",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Role"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Policy",
        "tags": [
          "v1",
          "governance"
        ]
      },
      "put": {
        "description": "Upsert the rule for ``(tag, role)``: ``mask`` (typed NULL +\nmetadata), ``deny`` (column disappears), or ``allow`` (a role's\nexplicit exemption over the ``role=\"*\"`` default).",
        "operationId": "set_policy_api_v1_workbooks__workbook_id__policies__tag__put",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "tag",
            "required": true,
            "schema": {
              "title": "Tag",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPolicyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Policy",
        "tags": [
          "v1",
          "governance"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/query": {
      "post": {
        "description": "Run a read-only SELECT and materialise the result.\n\nReturns a result-set manifest plus the first page in the requested\nformat. The manifest's ``id`` is the durable handle; subsequent\n``GET /api/v1/results/{id}`` calls read pages off the materialised\nParquet snapshot without re-running the query.",
        "operationId": "post_query_api_v1_workbooks__workbook_id__query_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "accept",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Accept"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryResultResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Post Query",
        "tags": [
          "v1",
          "query"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/query/validate": {
      "post": {
        "description": "Static check + schema dry-run for a SELECT, no execution.\n\nReturns ``{ valid, errors, columns }``. Use this when an agent wants\nto surface \"this query won't run\" before committing to /query — the\nfeedback loop is fast (no Parquet write, no result_id) and the\ncolumn list it returns is exact (it goes through DuckDB's planner,\nso a typo'd column name is caught here).",
        "operationId": "validate_query_api_v1_workbooks__workbook_id__query_validate_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Validate Query",
        "tags": [
          "v1",
          "query"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/recompute": {
      "post": {
        "description": "Re-run the transforms behind every stale table/view, dependency\norder, and clear their staleness.\n\nInteractive writes (row edits, override drops, merges) mark their\ndownstream artifacts stale instead of eagerly re-running them; this\nendpoint settles the whole backlog in one batch. Stale REPORTS are\nreturned in ``skipped_reports`` — their regeneration is an LLM call\nthe app's regenerate flow owns. Artifacts whose transform fails stay\nstale and are listed in ``failed``.",
        "operationId": "recompute_stale_api_v1_workbooks__workbook_id__recompute_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Recompute Stale",
        "tags": [
          "v1",
          "transforms"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/review": {
      "post": {
        "description": "Review a table (``target``) or the whole workbook and return\nevidence-backed findings. Read-only.\n\nChecks: the source file's formulas recomputed from its cells\n(overwritten values, broken fill-downs, ranges that stop short,\nsubtotals summed twice); invariants of each table (mixed types or\nspellings in a column, gaps and repeats in an ordered key, values the\ninput never had, totals a plain projection changed, rows that equal the\nsum of the rows above them); and, with ``judge``, whether each computed\ncolumn's label matches its computation. Every finding carries the SQL\nor the cell that found it. ``coverage`` says what was and was not\nexamined.\n\n``mode=lint`` answers ``200`` with the review when it finishes within\nabout 45 seconds, otherwise ``202`` with a job. ``mode=agent`` (or\n``async=true``) answers ``202`` at once. The job's ``result`` is the\nsame body. The judgement model and the agent spend the workbook's\ncredits (``credits``); out of credits, lint runs without the judgement\nmodel and the agent is refused (402). Refused on governed workbooks (403).",
        "operationId": "review_api_v1_workbooks__workbook_id__review_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewAcceptedResponse"
                }
              }
            },
            "description": "The review continues as a job — poll GET /api/v1/jobs/{job_id}."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Review",
        "tags": [
          "v1",
          "review"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sheets": {
      "get": {
        "operationId": "list_sheets_api_v1_workbooks__workbook_id__sheets_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SheetListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Sheets",
        "tags": [
          "v1",
          "sheets"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sheets/{name}": {
      "delete": {
        "operationId": "delete_sheet_api_v1_workbooks__workbook_id__sheets__name__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Sheet",
        "tags": [
          "v1",
          "sheets"
        ]
      },
      "get": {
        "operationId": "get_sheet_api_v1_workbooks__workbook_id__sheets__name__get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SheetResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Sheet",
        "tags": [
          "v1",
          "sheets"
        ]
      },
      "put": {
        "description": "Create or replace a sheet composition.\n\n``spec.blocks`` is an ordered vertical flow of\n``{kind: heading|text|table_view|spacer, ...}``; ``table_view``\nblocks REFERENCE tables by name (n:m — the same table can sit on\nmany sheets, and deleting a sheet deletes no data).",
        "operationId": "put_sheet_api_v1_workbooks__workbook_id__sheets__name__put",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutSheetRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SheetResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Put Sheet",
        "tags": [
          "v1",
          "sheets"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sheets/{name}/render": {
      "get": {
        "description": "Compose the sheet into an xlsx. Table blocks read through the\ngovernance projection — masked columns deliver as blanks, denied\ncolumns are absent — exactly like the rows surface.",
        "operationId": "render_sheet_api_v1_workbooks__workbook_id__sheets__name__render_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Render Sheet",
        "tags": [
          "v1",
          "sheets"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/snapshots": {
      "get": {
        "description": "List committed snapshots for the workbook.",
        "operationId": "list_snapshots_api_v1_workbooks__workbook_id__snapshots_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Snapshots",
        "tags": [
          "v1",
          "transforms"
        ]
      },
      "post": {
        "description": "Commit the current state as an immutable snapshot.\n\nSubsequent edits land on a fresh editing snapshot; the snapshot\njust committed becomes the rollback target for\n``POST .../snapshots/{id}/restore``.",
        "operationId": "commit_snapshot_api_v1_workbooks__workbook_id__snapshots_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommitSnapshotRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Commit Snapshot",
        "tags": [
          "v1",
          "transforms"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/snapshots/{snapshot_id}/restore": {
      "post": {
        "description": "Roll back to a prior snapshot. Destructive — requires workbooks:delete.",
        "operationId": "restore_snapshot_api_v1_workbooks__workbook_id__snapshots__snapshot_id__restore_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "snapshot_id",
            "required": true,
            "schema": {
              "title": "Snapshot Id",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Restore Snapshot",
        "tags": [
          "v1",
          "transforms"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources": {
      "get": {
        "description": "The workbook's sources with their lifecycle status.",
        "operationId": "list_sources_api_v1_workbooks__workbook_id__sources_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourcesListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Sources",
        "tags": [
          "v1",
          "ingest"
        ]
      },
      "post": {
        "description": "Upload a file into the workbook.\n\n``mode=auto`` (default) runs the one-shot extraction pipeline and the\nresponse carries the created source + every artifact it produced.\n``mode=staged`` only lands the bytes (zero interpretation, status\n``registered``) — follow with ``POST .../sources/{name}/analyze``,\nreview/correct the parse spec, then ``POST .../sources/{name}/materialize``.\n\n``async=true`` (auto mode only): the pipeline includes the\nstructuring pass, so for big files the synchronous form can hold\nthe socket for minutes. The async form returns ``202`` with a\n``job_id`` immediately; poll ``GET /api/v1/jobs/{job_id}`` for the\nterminal result (the data events — ``source.materialized``,\n``artifact.updated`` — still arrive on webhooks as usual). Job\nstate is process-local with a 1h retention; a deploy mid-job loses\nthe handle but never the workbook's durable state.\n\nIdempotency: pass ``Idempotency-Key: <opaque>`` to make a retry\nsafe — the cached response is returned for 24 h (for async calls\nthe same ``job_id`` is replayed). Even without the header,\nidentical bytes in the same workbook are de-duplicated: we return\nthe existing source rather than re-ingesting.",
        "operationId": "post_source_api_v1_workbooks__workbook_id__sources_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_post_source_api_v1_workbooks__workbook_id__sources_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAcceptedResponse"
                }
              }
            },
            "description": "async=true — poll GET /api/v1/jobs/{job_id}"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Post Source",
        "tags": [
          "v1",
          "ingest"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources/cloud": {
      "post": {
        "description": "Download a file from the caller's Google Drive or OneDrive /\nSharePoint into the workbook and run extraction — the same ingest as\na direct upload, with the file's provenance stamped on the source so\nit can be refreshed later.",
        "operationId": "import_cloud_file_api_v1_workbooks__workbook_id__sources_cloud_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CloudImportRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Import Cloud File",
        "tags": [
          "v1",
          "cloud-files"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources/from-url": {
      "post": {
        "description": "Fetch a public URL server-side and ingest it (same response as\n``POST /workbooks/{id}/sources``). Private networks, localhost and\nredirects are refused; the size cap applies while streaming.",
        "operationId": "ingest_from_url_api_v1_workbooks__workbook_id__sources_from_url_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlIngestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Ingest From Url Api V1 Workbooks  Workbook Id  Sources From Url Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Ingest From Url",
        "tags": [
          "v1",
          "uploads"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources/{source_name}": {
      "get": {
        "description": "One source + a summary of its parse spec (when analysed).",
        "operationId": "get_source_api_v1_workbooks__workbook_id__sources__source_name__get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_name",
            "required": true,
            "schema": {
              "title": "Source Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Source",
        "tags": [
          "v1",
          "ingest"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources/{source_name}/analyze": {
      "post": {
        "description": "Run structure detection and persist the ParseSpec proposal.\n\nPure inference — nothing is materialised. Re-running bumps the spec\nversion and discards prior edits. Fires ``source.analyzed``.",
        "operationId": "analyze_source_api_v1_workbooks__workbook_id__sources__source_name__analyze_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_name",
            "required": true,
            "schema": {
              "title": "Source Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Analyze Source",
        "tags": [
          "v1",
          "ingest"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources/{source_name}/download": {
      "get": {
        "description": "The source's ORIGINAL uploaded bytes, byte-identical (v0.5 §5.2 L0).\n\nThis is the honest answer to \"give me the original file back\": no\nreconstruction, the file itself. Refused on governed workbooks for\nthe same reason as preview — the original bytes bypass column\npolicies.",
        "operationId": "download_source_api_v1_workbooks__workbook_id__sources__source_name__download_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_name",
            "required": true,
            "schema": {
              "title": "Source Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Download Source",
        "tags": [
          "v1",
          "ingest"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources/{source_name}/materialize": {
      "post": {
        "description": "Faithfully load the selected regions into tables.\n\nDefault selection is every ``kind=\"data\"`` region. ``target.mode=\"new\"``\ncreates one table per region; ``\"append\"`` accumulates rows into the\nexisting ``target.table`` (column-matched by name via\n``target.column_mapping``). Fires ``source.materialized`` +\n``artifact.updated`` per produced artifact.",
        "operationId": "materialize_source_api_v1_workbooks__workbook_id__sources__source_name__materialize_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_name",
            "required": true,
            "schema": {
              "title": "Source Name",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/MaterializeRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaterializeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Materialize Source",
        "tags": [
          "v1",
          "ingest"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources/{source_name}/parse-spec": {
      "get": {
        "description": "The current ParseSpec document (regions + reader parameters).",
        "operationId": "get_parse_spec_api_v1_workbooks__workbook_id__sources__source_name__parse_spec_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_name",
            "required": true,
            "schema": {
              "title": "Source Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Parse Spec",
        "tags": [
          "v1",
          "ingest"
        ]
      },
      "put": {
        "description": "Correct the proposal: split/merge/exclude regions, fix ranges,\nkinds, or header flags. Bumps the spec version (status ``edited``).",
        "operationId": "put_parse_spec_api_v1_workbooks__workbook_id__sources__source_name__parse_spec_put",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_name",
            "required": true,
            "schema": {
              "title": "Source Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateParseSpecRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Put Parse Spec",
        "tags": [
          "v1",
          "ingest"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources/{source_name}/preview": {
      "get": {
        "description": "A bounded look at the source's RAW BYTES (spec §5 files.preview):\nthe first rows of each sheet, before any analysis or\nmaterialisation — so an agent can decide what to do with a file it\njust landed (staged sources preview straight from ``registered``).\n\nRefused on governed workbooks: the original bytes would bypass\ncolumn policies, so once any policy exists, reads go through the\npolicy-applied rows/schema/profile surfaces instead.",
        "operationId": "preview_source_api_v1_workbooks__workbook_id__sources__source_name__preview_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_name",
            "required": true,
            "schema": {
              "title": "Source Name",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "rows",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 50,
              "minimum": 1,
              "title": "Rows",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Preview Source",
        "tags": [
          "v1",
          "ingest"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources/{source_name}/render": {
      "get": {
        "description": "Template write-back (v0.5 §5.2 L1): the source's ORIGINAL xlsx\nwith its data-region cell values replaced by the current tables.\n\nStyles, merges, column widths, charts, images, macros and every\nformula OUTSIDE the data regions survive byte-identical — the\noriginal file is the style store; only the linked regions' values\nchange. xlsx + staged-materialised (region-linked) sources only;\na table that grew past its template region is refused (409).\n\n``overrides`` (JSON ``{\"<region table>\": \"<replacement table>\"}``)\nwrites a derived/transform table into a region in place of its\nlinked source table — faithful output with the computation kept\nserver-side and lineage-traceable. The replacement must carry the\nregion's columns by name.\n\nRefused on governed workbooks: the template's non-data cells are\noriginal bytes, which bypass column policies.",
        "operationId": "render_source_template_api_v1_workbooks__workbook_id__sources__source_name__render_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_name",
            "required": true,
            "schema": {
              "title": "Source Name",
              "type": "string"
            }
          },
          {
            "description": "Optional JSON object mapping a region-linked table name → a replacement (e.g. transform) table name. That region is written from the replacement instead of the linked source table, so a SQL transform's result renders into the template.",
            "in": "query",
            "name": "overrides",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional JSON object mapping a region-linked table name → a replacement (e.g. transform) table name. That region is written from the replacement instead of the linked source table, so a SQL transform's result renders into the template.",
              "title": "Overrides"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Render Source Template",
        "tags": [
          "v1",
          "ingest"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sources/{source_name}/revise": {
      "post": {
        "description": "Faithful edit in one call (v0.5 §5.2 L1): analyze + materialize +\ntransform + template write-back, folded.\n\nApplies ``transform`` (a ``{{ artifact_name }}`` SQL template with\n``{{ src }}`` bound to the target region's table) to a region of the\nsource, then returns the ORIGINAL xlsx with only that region's values\nreplaced — styles/charts/other sheets byte-identical. The transform\npersists (its DAG is queryable); positional write-back and in-region\nformula protection apply. Carry ``MIN(\"__d2b_row_id\")`` in the SELECT\nto keep row positions on a folding merge.\n\nRegion: ``region.region_id`` (existing), ``region.sheet``+``range``\n(reuse-or-add the rectangle — no separate update-parse-spec call), or\nomit for the source's single data region. Refused on governed\nworkbooks (the template's non-data cells bypass column policies).",
        "operationId": "revise_source_endpoint_api_v1_workbooks__workbook_id__sources__source_name__revise_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "source_name",
            "required": true,
            "schema": {
              "title": "Source Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviseRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Revise Source Endpoint",
        "tags": [
          "v1",
          "ingest"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sync": {
      "post": {
        "description": "One-call sync of a returned export (design pillar 3, Tier 0 — the\n\"agent mails a workbook, the end user edits it in Excel, the file\ncomes back\" loop).\n\nMerges EVERY branched table whose sheet the file still carries, via\nthe same per-table 3-way arbitration as ``.../merge`` (clean changes\napply as attributed edits, both-sides changes queue ``kind=\"merge\"``\nconflicts). ``branch_id`` defaults to the newest recorded branch.\nTables whose sheet is missing are reported in ``skipped``; a sheet\nthat fails to parse lands in ``errors`` without aborting the rest.\nRecords one ``source.sync`` op summarizing the whole exchange.",
        "operationId": "sync_returned_file_api_v1_workbooks__workbook_id__sync_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_sync_returned_file_api_v1_workbooks__workbook_id__sync_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Sync Returned File",
        "tags": [
          "v1",
          "deliver"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sync-bindings": {
      "get": {
        "description": "The workbook's stored bindings (optionally one artifact's).",
        "operationId": "list_sync_bindings_api_v1_workbooks__workbook_id__sync_bindings_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "artifact",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Artifact"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 200,
              "maximum": 1000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Sync Bindings",
        "tags": [
          "v1",
          "deliver"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sync-bindings/{binding_id}": {
      "delete": {
        "description": "Remove a stored binding (the external sheet itself is untouched).",
        "operationId": "unbind_sync_api_v1_workbooks__workbook_id__sync_bindings__binding_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "binding_id",
            "required": true,
            "schema": {
              "title": "Binding Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "actor",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "title": "Actor",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Unbind Sync",
        "tags": [
          "v1",
          "deliver"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/sync-bindings/{binding_id}/snapshot": {
      "get": {
        "description": "The diff baseline for the agent's sync cycle: governance-applied\nrows (row-id keyed when present) captured together with the table's\nedit version.",
        "operationId": "binding_snapshot_api_v1_workbooks__workbook_id__sync_bindings__binding_id__snapshot_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "binding_id",
            "required": true,
            "schema": {
              "title": "Binding Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10000,
              "maximum": 100000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Binding Snapshot",
        "tags": [
          "v1",
          "deliver"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables": {
      "get": {
        "description": "List artifacts (tables + views) for one workbook, refreshing\nthe catalog first so the response reflects DuckDB state.\n\nArchived artifacts — raw shapes the structured tier superseded at\ningest (promotion model) — are hidden by default; every row carries\n``state``. ``include_archived=true`` appends them (``state:\n\"archived\"``, no schema/row_count — their table is not materialised)\nso an agent can see what ``unarchive`` would bring back.",
        "operationId": "list_artifacts_api_v1_workbooks__workbook_id__tables_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_archived",
            "required": false,
            "schema": {
              "default": false,
              "title": "Include Archived",
              "type": "boolean"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Artifacts",
        "tags": [
          "v1",
          "data"
        ]
      },
      "post": {
        "description": "Create an empty table from a schema — no source file required.\n\nThe table registers as an editable raw artifact with row-ids\nassigned and ``edit_version`` seeded at 1, so rows can be upserted\nimmediately (``expected_version: 1``). Emits ``artifact.updated``.",
        "operationId": "create_table_api_v1_workbooks__workbook_id__tables_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTableRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateTableResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Table",
        "tags": [
          "v1",
          "tables"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}": {
      "delete": {
        "description": "Drop an artifact (table or view). Destructive — requires workbooks:delete.",
        "operationId": "delete_artifact_api_v1_workbooks__workbook_id__tables__name__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Artifact",
        "tags": [
          "v1",
          "transforms"
        ]
      },
      "get": {
        "description": "Single-artifact metadata. Returns schema, row_count, source files,\nand ``freshness`` — whether the artifact still reflects its inputs\n(design §9: staleness is a first-class, introspectable state).",
        "operationId": "get_artifact_api_v1_workbooks__workbook_id__tables__name__get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Artifact",
        "tags": [
          "v1",
          "data"
        ]
      },
      "patch": {
        "description": "Rename an artifact's display name (id-identity refactor P4): the immutable\nid and the physical table are untouched, so downstream transforms follow via\nthe binding ids and reads keep working under the new name. Refuses a taken\nname (409) and, for now, a python-transform output.",
        "operationId": "rename_table_api_v1_workbooks__workbook_id__tables__name__patch",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameTableRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactSummary"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Rename Table",
        "tags": [
          "v1",
          "data"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/a1": {
      "get": {
        "description": "A1 read facade (v0.5 §7): the coordinate system agents know best.\n\nThe table renders as a grid — row 1 is the header (column names),\ndata starts at row 2, columns A.. follow the (policy-applied)\ncolumn order. ``range`` is ``\"B2:D10\"`` or a single cell ``\"C3\"``.\nReturns ``{\"range\", \"values\": [[...]]}`` — values only, like the\nSheets API. Reads ride the same governance projection as rows.",
        "operationId": "read_a1_api_v1_workbooks__workbook_id__tables__name__a1_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "range",
            "required": true,
            "schema": {
              "maxLength": 30,
              "minLength": 2,
              "title": "Range",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/A1Response"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Read A1",
        "tags": [
          "v1",
          "data"
        ]
      },
      "put": {
        "description": "A1 write facade: set a rectangle of cells by spreadsheet\ncoordinates (the partner to GET .../a1).\n\nGrid row 1 is the header; data starts at row 2; columns A.. follow\nthe data-column order. ``values`` is a row-major 2-D block matching\nthe ``range`` shape. Grid rows that hit existing data rows update;\nrows past the bottom append (contiguous only). Maps onto row edits —\nsame optimistic locking (``expected_version``), edit log, and\nconflict detection as rows.upsert. Writing the header row, a column\npast the table width, or leaving a gap is a 400.",
        "operationId": "write_a1_api_v1_workbooks__workbook_id__tables__name__a1_put",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/A1WriteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpsertRowsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Write A1",
        "tags": [
          "v1",
          "rows"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/access": {
      "get": {
        "description": "Dry-run (spec `access.check`): what would a read of this artifact\nreturn, per column — allow / mask / deny — without reading anything.\nHonors ``X-D2B-Acting-User``, so a backend can preview a member's\neffective access before running queries on their behalf.",
        "operationId": "check_access_api_v1_workbooks__workbook_id__tables__name__access_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Check Access",
        "tags": [
          "v1",
          "governance"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/columns": {
      "post": {
        "description": "Add a column to an editable table (all NULL, or ``default``\neverywhere). The column lands before ``__d2b_row_id`` so the row-id\nkeeps riding last. Type from the create-table allow-list.",
        "operationId": "add_column_api_v1_workbooks__workbook_id__tables__name__columns_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddColumnRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ColumnsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Add Column",
        "tags": [
          "v1",
          "columns"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/columns/{column}": {
      "delete": {
        "description": "Drop a column from an editable table. The last data column can't\nbe dropped (delete the table instead). Any classification on the\ncolumn is removed.",
        "operationId": "drop_column_api_v1_workbooks__workbook_id__tables__name__columns__column__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "actor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor"
            }
          },
          {
            "in": "query",
            "name": "expected_version",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Expected Version"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ColumnsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Drop Column",
        "tags": [
          "v1",
          "columns"
        ]
      },
      "patch": {
        "description": "Rename (``new_name``) OR retype (``type``) one column — exactly\none per call. Retype casts existing values; a value that can't cast\ncleanly is a 400 (clean the data or use a SQL transform).",
        "operationId": "alter_column_api_v1_workbooks__workbook_id__tables__name__columns__column__patch",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlterColumnRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ColumnsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Alter Column",
        "tags": [
          "v1",
          "columns"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/columns/{column}/description": {
      "put": {
        "description": "Set or clear the description for one column on an artifact.\n\nThe column must exist in the artifact's schema (we check the\nschema dictionary stored on the catalog row); a misspelled column\nname surfaces as 404 rather than silently creating a phantom\ndescription that never lights up in get_schema.",
        "operationId": "set_column_description_api_v1_workbooks__workbook_id__tables__name__columns__column__description_put",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ColumnDescriptionBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Column Description",
        "tags": [
          "v1",
          "descriptions"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/columns/{column}/formula": {
      "delete": {
        "description": "Drop ``column``'s formula — it delivers its stored value again.",
        "operationId": "clear_formula_api_v1_workbooks__workbook_id__tables__name__columns__column__formula_delete",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Clear Formula",
        "tags": [
          "v1",
          "formulas"
        ]
      },
      "put": {
        "description": "Deliver ``column`` as a per-row formula.\n\n``expr`` references columns as ``{column_name}`` placeholders (never A1\ncell addresses) — e.g. ``\"{running} / {count}\"``. The stored value is\nuntouched; the formula is applied when the table is exported to xlsx. The\nresponse carries a ``verification`` report — whether the formula reproduces\nthe column's current values within tolerance — so \"replace this constant\nwith a calc\" can be confirmed, not hoped.",
        "operationId": "set_formula_api_v1_workbooks__workbook_id__tables__name__columns__column__formula_put",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetFormulaRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Formula",
        "tags": [
          "v1",
          "formulas"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/columns/{column}/tags": {
      "post": {
        "description": "Attach a sensitivity tag (``pii`` / ``hr`` / …) to a column.",
        "operationId": "tag_column_api_v1_workbooks__workbook_id__tables__name__columns__column__tags_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TagColumnRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Tag Column",
        "tags": [
          "v1",
          "governance"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/columns/{column}/tags/{tag}": {
      "delete": {
        "description": "Remove a column's tag (its policies stop applying to this column).",
        "operationId": "untag_column_api_v1_workbooks__workbook_id__tables__name__columns__column__tags__tag__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "column",
            "required": true,
            "schema": {
              "title": "Column",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "tag",
            "required": true,
            "schema": {
              "title": "Tag",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "actor",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "title": "Actor",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Untag Column",
        "tags": [
          "v1",
          "governance"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/description": {
      "put": {
        "description": "Set or clear the description for one artifact.\n\nThe catalog must already contain a row for this artifact — i.e.\nthe artifact was registered via a prior ingest or transform. We\nrefresh the catalog on entry so a brand-new artifact created\nseconds ago is reachable.",
        "operationId": "set_artifact_description_api_v1_workbooks__workbook_id__tables__name__description_put",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ArtifactDescriptionBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Artifact Description",
        "tags": [
          "v1",
          "descriptions"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/formulas": {
      "get": {
        "description": "The table's formula columns: ``{column: expr}``.",
        "operationId": "list_formulas_api_v1_workbooks__workbook_id__tables__name__formulas_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Formulas",
        "tags": [
          "v1",
          "formulas"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/lineage": {
      "get": {
        "description": "Upstream DAG for one artifact (sources + transform-derived intermediates).",
        "operationId": "get_artifact_lineage_api_v1_workbooks__workbook_id__tables__name__lineage_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Artifact Lineage",
        "tags": [
          "v1",
          "data"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/merge": {
      "post": {
        "description": "3-way merge an edited export back into its table.\n\nCells changed only in the file apply as attributed edits; cells\nchanged on both sides since the branch queue ``kind=\"merge\"``\nconflicts (D2B's value stays until someone resolves —\n``take_import`` applies the file's value, ``acknowledge`` keeps\nours). Rows the file deleted delete here when D2B left them\nuntouched; rows D2B deleted are never silently resurrected.",
        "operationId": "merge_export_api_v1_workbooks__workbook_id__tables__name__merge_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_merge_export_api_v1_workbooks__workbook_id__tables__name__merge_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Merge Export",
        "tags": [
          "v1",
          "deliver"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/overrides": {
      "get": {
        "description": "The artifact's override layer: which cells are shadowed, by what\nvalue, over which computed value, by whom and when (doc §6 — the\noverride story is always inspectable).",
        "operationId": "list_overrides_api_v1_workbooks__workbook_id__tables__name__overrides_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 500,
              "maximum": 1000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Overrides",
        "tags": [
          "v1",
          "rows"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/overrides/delete": {
      "post": {
        "description": "Remove one cell's override and restore the computed value it\nshadowed. The explicit exception ends explicitly.",
        "operationId": "drop_override_api_v1_workbooks__workbook_id__tables__name__overrides_delete_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DropOverrideRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Drop Override",
        "tags": [
          "v1",
          "rows"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/profile": {
      "get": {
        "description": "SUMMARIZE-style statistics for one table (spec §5 tables.profile):\nper-column null rate, distinct count, numeric ranges, top values and\nnormalisation signals — the deep look ``schema``'s 5-row sample\ncan't give. Governance applies: denied columns are absent, masked\ncolumns carry no statistics (their distribution is what the mask\nhides), and an enforced read is audited.",
        "operationId": "get_artifact_profile_api_v1_workbooks__workbook_id__tables__name__profile_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Artifact Profile",
        "tags": [
          "v1",
          "data"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/rows": {
      "get": {
        "description": "Paginated rows in JSON shape: ``{columns: [...], rows: [[...]]}``.\n\nThe row container is a list-of-lists (column-aligned) rather than\nlist-of-dicts, so per-row payload size stays close to Arrow's\ncolumnar footprint. Arrow + NDJSON content negotiation lands in\nSlice 3 (proposal §5 row payloads).",
        "operationId": "get_artifact_rows_api_v1_workbooks__workbook_id__tables__name__rows_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "maximum": 10000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RowsPageResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Artifact Rows",
        "tags": [
          "v1",
          "data"
        ]
      },
      "post": {
        "description": "Bulk upsert rows of a base table.\n\nA row carrying ``__d2b_row_id`` updates that row; a row without it\ninserts (missing columns become NULL, the new ``__d2b_row_id`` comes\nback in ``row_ids``). Atomic: one bad row rolls back the whole call.\n``expected_version`` must match the table's current edit version\n(pass ``null`` for a never-edited table); stale writes get 409 with\nthe current version. Each change lands in the edit log with\n``actor`` attribution.",
        "operationId": "upsert_rows_api_v1_workbooks__workbook_id__tables__name__rows_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertRowsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpsertRowsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Upsert Rows",
        "tags": [
          "v1",
          "rows"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/rows/delete": {
      "post": {
        "description": "Bulk delete rows by ``__d2b_row_id``.\n\nAtomic: an unknown row-id aborts the whole call. Each deleted row's\nfull content is recorded in the edit log before removal, so the\ndelete is logical-in-effect (nothing is lost) while reads stay clean.\nSame optimistic locking as upsert.",
        "operationId": "delete_rows_api_v1_workbooks__workbook_id__tables__name__rows_delete_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteRowsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteRowsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Rows",
        "tags": [
          "v1",
          "rows"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/schema": {
      "get": {
        "description": "Schema-only response: columns + types + row count.\n\nCarries a 5-row sample so an agent can take a quick look without\ntriggering a paginated rows call.",
        "operationId": "get_artifact_schema_api_v1_workbooks__workbook_id__tables__name__schema_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "default": "columns",
              "pattern": "^(columns|json-schema)$",
              "title": "Format",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/TableSchemaResponse"
                    },
                    {
                      "$ref": "#/components/schemas/RowJsonSchemaResponse"
                    }
                  ],
                  "title": "Response Get Artifact Schema Api V1 Workbooks  Workbook Id  Tables  Name  Schema Get"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Artifact Schema",
        "tags": [
          "v1",
          "data"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/style": {
      "get": {
        "description": "Current spec + annotations for one table.",
        "operationId": "get_style_api_v1_workbooks__workbook_id__tables__name__style_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StyleStateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Style",
        "tags": [
          "v1",
          "styles"
        ]
      },
      "put": {
        "description": "Replace the table's style spec.\n\n``spec`` = ``{header?, columns?, rules?, column_widths?, freeze_header?,\nborders?}``; styles are\n``{bold, italic, underline, color, fill, number_format, align}``.\nRules carry a SQL predicate (``\"amount < 0\"``) re-evaluated at\ndelivery — the right tool for bulk styling (\"negatives in red\"),\nsince one rule never drifts and never costs 10k annotations.",
        "operationId": "put_style_api_v1_workbooks__workbook_id__tables__name__style_put",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutStyleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Put Style",
        "tags": [
          "v1",
          "styles"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/style/annotations": {
      "post": {
        "description": "Mark specific cells: ``{annotations: [{row_id, column, style}]}``.\n\nAnchored to ``__d2b_row_id`` × column — the same identity anchoring\nas value edits, so the mark follows the row through sorts and\ninserts (\"THIS row\", not \"the 5th row\"). For bulk conditions use a\nspec rule instead.",
        "operationId": "annotate_api_v1_workbooks__workbook_id__tables__name__style_annotations_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnnotateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Annotate",
        "tags": [
          "v1",
          "styles"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/style/annotations/delete": {
      "post": {
        "operationId": "delete_annotations_api_v1_workbooks__workbook_id__tables__name__style_annotations_delete_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteAnnotationsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Annotations",
        "tags": [
          "v1",
          "styles"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/sync-bindings": {
      "post": {
        "description": "Store the table ↔ external-sheet mapping (inert — D2B never\nexecutes the sync). One sheet maps to one table; binding a governed\ntable returns explicit warnings instead of silently leaking.",
        "operationId": "bind_sync_api_v1_workbooks__workbook_id__tables__name__sync_bindings_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BindRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Bind Sync",
        "tags": [
          "v1",
          "deliver"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/tables/{name}/unarchive": {
      "post": {
        "description": "Re-materialise an archived raw artifact from the shared cache\n(D3, v0.5 §4): the registry row and lineage never left; this brings\nthe physical table back and flips state to active. Use it when an\nagent needs to descend from a structured table to the raw shape it\nwas derived from (follow get_lineage to find the name).",
        "operationId": "unarchive_artifact_api_v1_workbooks__workbook_id__tables__name__unarchive_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactStateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Unarchive Artifact",
        "tags": [
          "v1",
          "data"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/transforms": {
      "get": {
        "description": "Every authored transform that currently produces an artifact, with\nits template — the read half of ``POST /transforms``.\n\nOne entry per transform → artifact edge (a template applied to two\noutputs appears twice, once per ``artifact_name``). ``args`` carry the\nCURRENT display names of the bound inputs, so an entry round-trips\nthrough ``POST /transforms`` unchanged even after a rename. Built-in\nsource extractors (``auto_extractors/*``) are not listed — they are\nnot authored logic. Templates are code, not rows: column policies do\nnot apply here, exactly as in the app's Transform view.\n\nThis is what ``d2b pull`` materialises as ``transforms/*.sql|py``\nfiles, so a workbook's analytical logic can live in the caller's own\ngit repository and come back through ``d2b push``.",
        "operationId": "list_transforms_api_v1_workbooks__workbook_id__transforms_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransformListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Transforms",
        "tags": [
          "v1",
          "transforms"
        ]
      },
      "post": {
        "description": "Register a SQL or Python transform and materialise its output.\n\nThe transform runs synchronously; the response carries the resulting\nartifact metadata. Mirror of the SPA's chat-agent path, so agents\nand humans co-author the same DAG.",
        "operationId": "post_transform_api_v1_workbooks__workbook_id__transforms_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransformRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransformResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Post Transform",
        "tags": [
          "v1",
          "transforms"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/uploads": {
      "post": {
        "description": "Open an upload slot: the bytes go to ``upload_url`` (a signed PUT,\nno bearer needed, valid one hour) — from your own HTTP client, or by\na human through ``upload_page`` — and ``POST .../uploads/{id}/ingest``\nturns them into a source. Nothing about the file passes through the\ncaller, which is the point for agents.",
        "operationId": "create_upload_slot_api_v1_workbooks__workbook_id__uploads_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadSlotRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Create Upload Slot Api V1 Workbooks  Workbook Id  Uploads Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Upload Slot",
        "tags": [
          "v1",
          "uploads"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/uploads/{upload_id}/ingest": {
      "post": {
        "description": "Turn a received upload into a source (same response as\n``POST /workbooks/{id}/sources``, plus ``upload_id``).",
        "operationId": "ingest_upload_slot_api_v1_workbooks__workbook_id__uploads__upload_id__ingest_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "upload_id",
            "required": true,
            "schema": {
              "title": "Upload Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Ingest Upload Slot Api V1 Workbooks  Workbook Id  Uploads  Upload Id  Ingest Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Ingest Upload Slot",
        "tags": [
          "v1",
          "uploads"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/versions": {
      "get": {
        "operationId": "list_versions_api_v1_workbooks__workbook_id__versions_get",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VersionListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Versions",
        "tags": [
          "v1",
          "versions"
        ]
      },
      "post": {
        "description": "Commit the current state as a named version (label → snapshot).\n\nLabels are immutable; committing an existing label is a 409.",
        "operationId": "create_version_api_v1_workbooks__workbook_id__versions_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVersionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VersionInfo"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Version",
        "tags": [
          "v1",
          "versions"
        ]
      }
    },
    "/api/v1/workbooks/{workbook_id}/versions/{label}/revert": {
      "post": {
        "description": "Restore the workbook to the named version's snapshot — the same\ndestructive machinery (and the same events) as snapshot restore.",
        "operationId": "revert_to_version_api_v1_workbooks__workbook_id__versions__label__revert_post",
        "parameters": [
          {
            "in": "path",
            "name": "workbook_id",
            "required": true,
            "schema": {
              "title": "Workbook Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "label",
            "required": true,
            "schema": {
              "title": "Label",
              "type": "string"
            }
          },
          {
            "in": "cookie",
            "name": "d2b_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "D2B Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevertResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Revert To Version",
        "tags": [
          "v1",
          "versions"
        ]
      }
    }
  },
  "servers": [
    {
      "description": "Production",
      "url": "https://d2b.dev"
    }
  ]
}
