{
  "components": {
    "schemas": {
      "AccountBankTransactionsRequest": {
        "properties": {
          "instructions": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "transaction_ids"
        ],
        "type": "object"
      },
      "AccountSummaryResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BankAccountResponse"
          },
          {
            "properties": {
              "signed_sum": {
                "type": "string"
              },
              "statuses": {
                "additionalProperties": {
                  "$ref": "#/components/schemas/StatusTotalResponse"
                },
                "propertyNames": {
                  "type": "string"
                },
                "type": "object"
              },
              "transaction_count": {
                "format": "int64",
                "type": "integer"
              }
            },
            "required": [
              "statuses",
              "transaction_count",
              "signed_sum"
            ],
            "type": "object"
          }
        ],
        "description": "Per-account row. Flatten the base BankAccountResponse fields (id,\nbank_name, account_label, etc.) at the top level so the wire shape has all\naccount fields siblings to `statuses`, `transaction_count`, and\n`signed_sum`."
      },
      "AccountingCustomerRowResponse": {
        "properties": {
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "emails": {
            "items": {
              "$ref": "#/components/schemas/CustomerEmailEntryResponse"
            },
            "type": "array"
          },
          "id": {
            "type": "string"
          },
          "invoice_count": {
            "format": "int64",
            "type": "integer"
          },
          "last_invoice_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "open_invoice_amount": {
            "format": "double",
            "type": "number"
          },
          "open_invoice_count": {
            "format": "int64",
            "type": "integer"
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "outstanding_amount": {
            "format": "double",
            "type": "number"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_invoiced": {
            "format": "double",
            "type": "number"
          },
          "unposted_invoice_amount": {
            "format": "double",
            "type": "number"
          },
          "unposted_invoice_count": {
            "format": "int64",
            "type": "integer"
          },
          "zip_code": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "emails",
          "invoice_count",
          "open_invoice_count",
          "total_invoiced",
          "outstanding_amount",
          "unposted_invoice_count",
          "unposted_invoice_amount",
          "open_invoice_amount"
        ],
        "type": "object"
      },
      "AccountingEntryCompleteRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AccountingEntryUpdateRequest"
          },
          {
            "properties": {
              "mark_ready": {
                "type": "boolean"
              }
            },
            "type": "object"
          }
        ]
      },
      "AccountingEntryCorrectRequest": {
        "properties": {
          "correction_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/AccountingEntryLineInput"
            },
            "type": "array"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "AccountingEntryCreateRequest": {
        "properties": {
          "bank_transaction_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "base_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "context": {
            "type": "object"
          },
          "customer": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CustomerInput"
              }
            ]
          },
          "customer_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "document_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry_date": {
            "format": "date",
            "type": "string"
          },
          "entry_kind": {
            "type": "string"
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "external_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "intent": {
            "type": "string"
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/AccountingEntryLineInput"
            },
            "type": "array"
          },
          "llm_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "source_document_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "source_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "source_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "boolean"
          },
          "supplier": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SupplierReference",
                "description": "Optional supplier attribution. Accepts one canonical internal id, a\nprovider-scoped external id, or supplier identity details."
              }
            ]
          },
          "voucher_series": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "intent",
          "entry_kind",
          "entry_date"
        ],
        "type": "object"
      },
      "AccountingEntryLineInput": {
        "properties": {
          "account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "accrual_end": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "accrual_start": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "book_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "cost_center": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit": {
            "type": "string"
          },
          "currency_unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "debit": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "employee_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_basis": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "line_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_credit": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_debit": {
            "type": [
              "string",
              "null"
            ]
          },
          "period_count": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "period_index": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "posting_rule_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "project": {
            "type": [
              "string",
              "null"
            ]
          },
          "provenance": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": [
              "string",
              "null"
            ]
          },
          "rate_evidence": {
            "type": "object"
          },
          "transaction_credit_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_debit_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_info": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_price": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_rate": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "AccountingEntryLinkRequest": {
        "properties": {
          "link_type": {
            "type": "string"
          },
          "metadata": {
            "type": "object"
          },
          "related_resource_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "related_resource_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          },
          "to_entry_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "link_type"
        ],
        "type": "object"
      },
      "AccountingEntryLinkResponse": {
        "description": "One row of `_load_links_by_entry_id`. The JSON key for the link's JSONB\npayload is `metadata` (the model attribute is `link_metadata`, mapped to\ncolumn `metadata`).",
        "properties": {
          "created_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "from_entry_id": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "link_type": {
            "type": "string"
          },
          "metadata": {
            "type": "object"
          },
          "related_resource_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "related_resource_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "to_entry_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "from_entry_id",
          "link_type",
          "metadata"
        ],
        "type": "object"
      },
      "AccountingEntryResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/LedgerEntryResponse",
            "description": "The ledger entry, shaped exactly like `serialize_entry`."
          },
          {
            "properties": {
              "links": {
                "description": "Accounting entry links (`accounting_entry_links`) for this entry.",
                "items": {
                  "$ref": "#/components/schemas/AccountingEntryLinkResponse"
                },
                "type": "array"
              },
              "source_document_ids": {
                "description": "The entry's own `source_document_id` (if any) followed by any\n`derived_from_document` link document ids, de-duplicated, order\npreserved.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "links",
              "source_document_ids"
            ],
            "type": "object"
          }
        ]
      },
      "AccountingEntryReverseRequest": {
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "reversal_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "AccountingEntryTableResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/AccountingEntryResponse"
            },
            "type": "array"
          },
          "page": {
            "format": "int64",
            "type": "integer"
          },
          "page_count": {
            "format": "int64",
            "type": "integer"
          },
          "page_size": {
            "format": "int64",
            "type": "integer"
          },
          "search_meta": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TableSearchMeta",
                "description": "Present only when a text `search` was applied; `null` otherwise."
              }
            ]
          },
          "total": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "page_size",
          "page_count"
        ],
        "type": "object"
      },
      "AccountingEntryTimelineResponse": {
        "properties": {
          "entry": {
            "$ref": "#/components/schemas/AccountingEntryResponse",
            "description": "The requested entry."
          },
          "resources": {
            "description": "Source documents, bank transactions, and employee-expense rollups\nreferenced by the timeline's entries. Shape varies by `type`.",
            "items": {
              "type": "object"
            },
            "type": "array"
          },
          "timeline": {
            "description": "The entry and its related entries, ordered by `(entry_date,\ncreated_at)`.",
            "items": {
              "$ref": "#/components/schemas/AccountingEntryResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "entry",
          "timeline",
          "resources"
        ],
        "type": "object"
      },
      "AccountingEntryUpdateRequest": {
        "properties": {
          "bank_transaction_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "base_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "context_patch": {
            "type": "object"
          },
          "customer": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CustomerInput"
              }
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "document_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "entry_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "external_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "intent": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/AccountingEntryLineInput"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "llm_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "source_document_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "source_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "boolean"
          },
          "supplier": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SupplierReference",
                "description": "Optional supplier attribution for this draft. Omit to preserve the\ncurrent supplier; supplier is never required to update or post."
              }
            ]
          }
        },
        "type": "object"
      },
      "AccountingFlowActivateRequest": {
        "properties": {
          "version": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "version"
        ],
        "type": "object"
      },
      "AccountingFlowArchetypeListResponse": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowArchetypeResponse"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "AccountingFlowArchetypeResponse": {
        "properties": {
          "description": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "label",
          "description"
        ],
        "type": "object"
      },
      "AccountingFlowAutonomyMode": {
        "enum": [
          "manual",
          "auto_to_draft"
        ],
        "type": "string"
      },
      "AccountingFlowCatalogPresetResponse": {
        "properties": {
          "category": {
            "type": "string"
          },
          "credit_account": {
            "type": "string"
          },
          "credit_account_name": {
            "type": "string"
          },
          "credit_role": {
            "type": "string"
          },
          "debit_account": {
            "type": "string"
          },
          "debit_account_name": {
            "type": "string"
          },
          "debit_role": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "inverse_of": {
            "type": [
              "string",
              "null"
            ]
          },
          "label": {
            "type": "string"
          },
          "tax_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "treatment": {
            "type": "string"
          },
          "vat_code": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "category",
          "label",
          "treatment",
          "debit_role",
          "debit_account",
          "debit_account_name",
          "credit_role",
          "credit_account",
          "credit_account_name"
        ],
        "type": "object"
      },
      "AccountingFlowCatalogProviderResponse": {
        "properties": {
          "archetypes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "emit_categories": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "presets": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowCatalogPresetResponse"
            },
            "type": "array"
          },
          "provider_id": {
            "type": "string"
          },
          "sample_payloads": {
            "description": "Object keyed by category: representative raw provider payloads for\nsource-mapping previews."
          }
        },
        "required": [
          "provider_id",
          "archetypes",
          "emit_categories",
          "presets",
          "sample_payloads"
        ],
        "type": "object"
      },
      "AccountingFlowCatalogResponse": {
        "properties": {
          "as_of": {
            "type": "string"
          },
          "categories": {
            "description": "Stageable categories, in canonical order (drives the UI dropdown).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "providers": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowCatalogProviderResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "as_of",
          "categories",
          "providers"
        ],
        "type": "object"
      },
      "AccountingFlowExecutionPolicy": {
        "properties": {
          "autonomy": {
            "$ref": "#/components/schemas/AccountingFlowAutonomyMode"
          },
          "grouping": {
            "$ref": "#/components/schemas/AccountingFlowGroupingMode"
          },
          "schedule": {
            "$ref": "#/components/schemas/AccountingFlowScheduleCadence"
          },
          "threshold_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "threshold_count": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "grouping",
          "schedule",
          "autonomy"
        ],
        "type": "object"
      },
      "AccountingFlowGroupingMode": {
        "enum": [
          "per_transaction",
          "daily_summary",
          "weekly_summary",
          "monthly_summary",
          "payout",
          "threshold_amount",
          "threshold_count"
        ],
        "type": "string"
      },
      "AccountingFlowListResponse": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowResponse"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "AccountingFlowNotificationCadence": {
        "enum": [
          "immediate",
          "daily",
          "weekly"
        ],
        "type": "string"
      },
      "AccountingFlowNotificationChannel": {
        "enum": [
          "in_app",
          "email"
        ],
        "type": "string"
      },
      "AccountingFlowNotificationPreferences": {
        "properties": {
          "cadence": {
            "$ref": "#/components/schemas/AccountingFlowNotificationCadence"
          },
          "channel": {
            "$ref": "#/components/schemas/AccountingFlowNotificationChannel"
          },
          "enabled": {
            "type": "boolean"
          },
          "triggers": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowNotificationTrigger"
            },
            "type": "array"
          }
        },
        "required": [
          "enabled",
          "channel",
          "cadence",
          "triggers"
        ],
        "type": "object"
      },
      "AccountingFlowNotificationTrigger": {
        "enum": [
          "run_completed",
          "needs_review",
          "threshold_hit"
        ],
        "type": "string"
      },
      "AccountingFlowReadiness": {
        "properties": {
          "blockers": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowReadinessBlocker"
            },
            "type": "array"
          },
          "completion_percent": {
            "format": "int32",
            "minimum": 0,
            "type": "integer"
          },
          "is_ready": {
            "type": "boolean"
          }
        },
        "required": [
          "is_ready",
          "completion_percent",
          "blockers"
        ],
        "type": "object"
      },
      "AccountingFlowReadinessBlocker": {
        "properties": {
          "code": {
            "type": "string"
          },
          "field": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "AccountingFlowResponse": {
        "properties": {
          "active_version": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "archetype": {
            "type": "string"
          },
          "clearing_account": {
            "description": "Date-resolved platform clearing (card/provider) BAS account the staging\nruntime books \u2014 1580 in 2025, 1686 in 2026. The UI shows this instead of\na hardcoded literal so the label matches the posted verifikat.",
            "type": "string"
          },
          "connected": {
            "description": "True iff the company has an active integration connection with the\nprovider-account identity required by the runtime. Unconnected providers\nare still listed so the UI can render them as locked cards.",
            "type": "boolean"
          },
          "connection_ids": {
            "description": "Active tenant connections that satisfy the runtime's provider-account\ncontract. The UI and workflow controls use these exact ids.",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "execution_policy": {
            "$ref": "#/components/schemas/AccountingFlowExecutionPolicy"
          },
          "frequency": {},
          "id": {
            "type": "string"
          },
          "input": {},
          "is_active": {
            "description": "Runtime ownership signal; independent of the latest version's status.",
            "type": "boolean"
          },
          "notification_preferences": {
            "$ref": "#/components/schemas/AccountingFlowNotificationPreferences"
          },
          "output": {},
          "provider_id": {
            "type": "string"
          },
          "provider_name": {
            "type": "string"
          },
          "readiness": {
            "$ref": "#/components/schemas/AccountingFlowReadiness"
          },
          "rule_set": {
            "$ref": "#/components/schemas/AccountingFlowRuleSetSnapshot"
          },
          "rule_set_status": {
            "type": "string"
          },
          "rule_set_version": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "source_label": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "visual_layout": {}
        },
        "required": [
          "id",
          "provider_id",
          "provider_name",
          "archetype",
          "source_label",
          "clearing_account",
          "connected",
          "connection_ids",
          "status",
          "rule_set_status",
          "is_active",
          "readiness",
          "execution_policy",
          "notification_preferences",
          "input",
          "rule_set",
          "output",
          "frequency",
          "visual_layout"
        ],
        "type": "object"
      },
      "AccountingFlowRuleSetRequest": {
        "properties": {
          "execution_policy": {
            "$ref": "#/components/schemas/AccountingFlowExecutionPolicy"
          },
          "frequency": {},
          "input": {},
          "mapping_overrides": {},
          "notification_preferences": {
            "$ref": "#/components/schemas/AccountingFlowNotificationPreferences"
          },
          "output": {},
          "review_thresholds": {},
          "rule_steps": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowRuleStep"
            },
            "type": "array"
          },
          "source_mapping": {},
          "taxonomy_rules": {},
          "visual_layout": {}
        },
        "type": "object"
      },
      "AccountingFlowRuleSetResponse": {
        "properties": {
          "archetype": {
            "type": "string"
          },
          "execution_policy": {
            "$ref": "#/components/schemas/AccountingFlowExecutionPolicy"
          },
          "frequency": {},
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "input": {},
          "mapping_overrides": {},
          "notification_preferences": {
            "$ref": "#/components/schemas/AccountingFlowNotificationPreferences"
          },
          "output": {},
          "provider_id": {
            "type": "string"
          },
          "readiness": {
            "$ref": "#/components/schemas/AccountingFlowReadiness"
          },
          "review_thresholds": {},
          "rule_steps": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowRuleStep"
            },
            "type": "array"
          },
          "source_mapping": {},
          "status": {
            "type": "string"
          },
          "taxonomy_rules": {},
          "version": {
            "format": "int32",
            "type": "integer"
          },
          "visual_layout": {}
        },
        "required": [
          "id",
          "provider_id",
          "archetype",
          "version",
          "status",
          "readiness",
          "execution_policy",
          "notification_preferences",
          "input",
          "source_mapping",
          "taxonomy_rules",
          "rule_steps",
          "mapping_overrides",
          "review_thresholds",
          "output",
          "frequency",
          "visual_layout"
        ],
        "type": "object"
      },
      "AccountingFlowRuleSetSnapshot": {
        "properties": {
          "mapping_overrides": {},
          "review_thresholds": {},
          "rule_steps": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowRuleStep"
            },
            "type": "array"
          },
          "source_mapping": {},
          "taxonomy_rules": {}
        },
        "required": [
          "source_mapping",
          "taxonomy_rules",
          "rule_steps",
          "mapping_overrides",
          "review_thresholds"
        ],
        "type": "object"
      },
      "AccountingFlowRuleStep": {
        "properties": {
          "category": {
            "type": "string"
          },
          "credit_account": {
            "type": "string"
          },
          "debit_account": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "region": {
            "description": "Country scope for the rule: `se` (Sweden only), `eu` (all EU member\nstates as one accounting set), or `non_eu` (everything outside the EU).\n`None` keeps the legacy country-agnostic match. Compiled into\nper-country / catch-all posting rules on activation.",
            "type": [
              "string",
              "null"
            ]
          },
          "tax_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "treatment": {
            "type": "string"
          },
          "vat_code": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "label",
          "category",
          "treatment",
          "debit_account",
          "credit_account"
        ],
        "type": "object"
      },
      "AccountingFlowScheduleCadence": {
        "enum": [
          "on_demand",
          "on_arrival",
          "daily",
          "weekly",
          "monthly"
        ],
        "type": "string"
      },
      "AccountingFlowTemplateApplyRequest": {
        "properties": {
          "template_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "template_id"
        ],
        "type": "object"
      },
      "AccountingFlowTemplateCreateRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AccountingFlowRuleSetRequest"
          },
          {
            "properties": {
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "name"
            ],
            "type": "object"
          }
        ]
      },
      "AccountingFlowTemplateListResponse": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowTemplateResponse"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "AccountingFlowTemplateResponse": {
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "execution_policy": {
            "$ref": "#/components/schemas/AccountingFlowExecutionPolicy"
          },
          "frequency": {},
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "input": {},
          "mapping_overrides": {},
          "name": {
            "type": "string"
          },
          "notification_preferences": {
            "$ref": "#/components/schemas/AccountingFlowNotificationPreferences"
          },
          "output": {},
          "readiness": {
            "$ref": "#/components/schemas/AccountingFlowReadiness"
          },
          "review_thresholds": {},
          "rule_steps": {
            "items": {
              "$ref": "#/components/schemas/AccountingFlowRuleStep"
            },
            "type": "array"
          },
          "source_archetype": {
            "type": "string"
          },
          "source_mapping": {},
          "source_provider_id": {
            "type": "string"
          },
          "taxonomy_rules": {},
          "visual_layout": {}
        },
        "required": [
          "id",
          "name",
          "source_provider_id",
          "source_archetype",
          "readiness",
          "execution_policy",
          "notification_preferences",
          "input",
          "source_mapping",
          "taxonomy_rules",
          "rule_steps",
          "mapping_overrides",
          "review_thresholds",
          "output",
          "frequency",
          "visual_layout"
        ],
        "type": "object"
      },
      "AccountingSupplierRowResponse": {
        "properties": {
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "invoice_count": {
            "format": "int64",
            "type": "integer"
          },
          "last_invoice_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "open_invoice_amount": {
            "format": "double",
            "type": "number"
          },
          "open_invoice_count": {
            "format": "int64",
            "type": "integer"
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "outstanding_amount": {
            "format": "double",
            "type": "number"
          },
          "settled_amount": {
            "format": "double",
            "type": "number"
          },
          "supplier_number": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "total_spend": {
            "format": "double",
            "type": "number"
          },
          "unposted_invoice_amount": {
            "format": "double",
            "type": "number"
          },
          "unposted_invoice_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "invoice_count",
          "open_invoice_count",
          "total_spend",
          "settled_amount",
          "outstanding_amount",
          "unposted_invoice_count",
          "unposted_invoice_amount",
          "open_invoice_amount"
        ],
        "type": "object"
      },
      "AccrualManualItem": {
        "properties": {
          "accrued_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount_delta": {
            "type": [
              "string",
              "null"
            ]
          },
          "cost_center": {
            "type": [
              "string",
              "null"
            ]
          },
          "current_liability_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "current_social_fee_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "expense_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "fee_type": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/AccrualManualKind"
          },
          "liability_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "policy_profile": {},
          "prepaid_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "prior_liability_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "prior_social_fee_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "project": {
            "type": [
              "string",
              "null"
            ]
          },
          "social_fee_delta": {
            "type": [
              "string",
              "null"
            ]
          },
          "social_fee_expense_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "social_fee_liability_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_basis": {},
          "source_period_end": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "source_period_start": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "vacation_expense_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "vacation_liability_account": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      "AccrualManualKind": {
        "enum": [
          "manual_accrued_expense",
          "manual_prepaid_expense",
          "audit_fee",
          "vacation_liability_change"
        ],
        "type": "string"
      },
      "AccrualPostRequest": {
        "properties": {
          "fiscal_period_id": {
            "format": "uuid",
            "type": "string"
          },
          "include": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "manual_items": {
            "items": {
              "$ref": "#/components/schemas/AccrualManualItem"
            },
            "type": "array"
          },
          "period_end": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "period_start": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "policy_profile": {}
        },
        "required": [
          "fiscal_period_id"
        ],
        "type": "object"
      },
      "AccrualPreviewRequest": {
        "properties": {
          "fiscal_period_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "include": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "manual_items": {
            "items": {
              "$ref": "#/components/schemas/AccrualManualItem"
            },
            "type": "array"
          },
          "period_end": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "period_start": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "policy_profile": {}
        },
        "type": "object"
      },
      "AccrualReverseDueRequest": {
        "properties": {
          "as_of": {
            "format": "date",
            "type": "string"
          }
        },
        "required": [
          "as_of"
        ],
        "type": "object"
      },
      "AccrualReverseDueStageRequest": {
        "properties": {
          "as_of": {
            "format": "date",
            "type": "string"
          },
          "requires_approval": {
            "type": "boolean"
          }
        },
        "required": [
          "as_of"
        ],
        "type": "object"
      },
      "AccrualStageRequest": {
        "properties": {
          "fiscal_period_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "include": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "manual_items": {
            "items": {
              "$ref": "#/components/schemas/AccrualManualItem"
            },
            "type": "array"
          },
          "period_end": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "period_start": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "policy_profile": {},
          "requires_approval": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "ActiveProviderResponse": {
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "label": {
            "type": "string"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "connected",
          "label"
        ],
        "type": "object"
      },
      "ActiveRunStatus": {
        "additionalProperties": {},
        "properties": {
          "applied_count": {
            "format": "int64",
            "type": "integer"
          },
          "applying_count": {
            "format": "int64",
            "type": "integer"
          },
          "cancelled_count": {
            "format": "int64",
            "type": "integer"
          },
          "conflict_count": {
            "format": "int64",
            "type": "integer"
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "exported_count": {
            "format": "int64",
            "type": "integer"
          },
          "failed_count": {
            "format": "int64",
            "type": "integer"
          },
          "generated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "inbox_conflict_count": {
            "format": "int64",
            "type": "integer"
          },
          "inbox_import_available": {
            "type": "boolean"
          },
          "inbox_import_count": {
            "format": "int64",
            "type": "integer"
          },
          "inbox_import_disabled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "inbox_steps": {
            "items": {},
            "type": "array"
          },
          "ledger_conflict_count": {
            "format": "int64",
            "type": "integer"
          },
          "ledger_post_available": {
            "type": "boolean"
          },
          "ledger_post_count": {
            "format": "int64",
            "type": "integer"
          },
          "ledger_post_disabled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_steps": {
            "items": {},
            "type": "array"
          },
          "local_snapshot_stale": {
            "type": "boolean"
          },
          "pending_count": {
            "format": "int64",
            "type": "integer"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_push_count": {
            "format": "int64",
            "type": "integer"
          },
          "pull_status": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PullStatus"
              }
            ]
          },
          "push_available": {
            "type": "boolean"
          },
          "push_disabled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "ready_count": {
            "format": "int64",
            "type": "integer"
          },
          "reconciliation_summary": {},
          "resync_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "resync_required": {
            "type": "boolean"
          },
          "run_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "run_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "scope": {
            "type": [
              "string",
              "null"
            ]
          },
          "stale_local_item_count": {
            "format": "int64",
            "type": "integer"
          },
          "stale_local_items": {
            "items": {},
            "type": "array"
          },
          "stale_local_items_sample": {
            "items": {},
            "type": "array"
          },
          "steps": {
            "items": {},
            "type": "array"
          },
          "synced_count": {
            "format": "int64",
            "type": "integer"
          },
          "total_count": {
            "format": "int64",
            "type": "integer"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "AgentHarnessSettingsOut": {
        "properties": {
          "company_id": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_by_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "writes_enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "company_id",
          "writes_enabled"
        ],
        "type": "object"
      },
      "AnalyticsAskRequest": {
        "properties": {
          "question": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "question"
        ],
        "type": "object"
      },
      "AnalyticsAskResponse": {
        "properties": {
          "chart_config": {},
          "column_types": {
            "items": {},
            "type": "array"
          },
          "columns": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "data": {
            "items": {},
            "type": "array"
          },
          "report": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SavedAnalyticsQueryResponse"
              }
            ]
          },
          "row_count": {
            "minimum": 0,
            "type": "integer"
          },
          "sql": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "sql",
          "chart_config",
          "columns",
          "data",
          "column_types",
          "row_count"
        ],
        "type": "object"
      },
      "AnalyticsQueryResultResponse": {
        "properties": {
          "column_types": {
            "items": {},
            "type": [
              "array",
              "null"
            ]
          },
          "columns": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "data": {
            "items": {},
            "type": "array"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "row_count": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "columns",
          "data",
          "row_count"
        ],
        "type": "object"
      },
      "ApiAcceptedWorkflow": {
        "properties": {
          "idempotency_key": {
            "type": "string"
          },
          "object": {
            "type": "string"
          },
          "run_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status_url": {
            "type": "string"
          },
          "workflow_id": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "workflow_id",
          "status_url",
          "idempotency_key"
        ],
        "type": "object"
      },
      "ApiDeleted": {
        "properties": {
          "deleted": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ],
        "type": "object"
      },
      "ApiErrorBody": {
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ApiErrorObject",
            "description": "Stable public error envelope for every canonical API error response."
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "ApiErrorObject": {
        "properties": {
          "code": {
            "description": "Stable machine-readable error code.",
            "type": "string"
          },
          "doc_url": {
            "description": "Optional documentation link for the stable error code.",
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "description": "Scrubbed public error message safe to show to users and API clients.",
            "type": "string"
          },
          "param": {
            "description": "Request parameter, header, path component, or body field associated with the error.",
            "type": [
              "string",
              "null"
            ]
          },
          "request_id": {
            "description": "Diagnostic support handle matching the `X-Request-Id` response header.",
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/ApiErrorType",
            "description": "Broad machine-readable error category."
          }
        },
        "required": [
          "type",
          "code",
          "message",
          "request_id"
        ],
        "type": "object"
      },
      "ApiErrorType": {
        "enum": [
          "api_error",
          "authentication_error",
          "authorization_error",
          "invalid_request",
          "idempotency_error",
          "not_found",
          "conflict",
          "rate_limit",
          "upstream_error",
          "service_unavailable"
        ],
        "type": "string"
      },
      "ApiList_AccountingCustomerRowResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "address": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "city": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "emails": {
                  "items": {
                    "$ref": "#/components/schemas/CustomerEmailEntryResponse"
                  },
                  "type": "array"
                },
                "id": {
                  "type": "string"
                },
                "invoice_count": {
                  "format": "int64",
                  "type": "integer"
                },
                "last_invoice_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "open_invoice_amount": {
                  "format": "double",
                  "type": "number"
                },
                "open_invoice_count": {
                  "format": "int64",
                  "type": "integer"
                },
                "org_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "outstanding_amount": {
                  "format": "double",
                  "type": "number"
                },
                "phone": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "total_invoiced": {
                  "format": "double",
                  "type": "number"
                },
                "unposted_invoice_amount": {
                  "format": "double",
                  "type": "number"
                },
                "unposted_invoice_count": {
                  "format": "int64",
                  "type": "integer"
                },
                "zip_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "emails",
                "invoice_count",
                "open_invoice_count",
                "total_invoiced",
                "outstanding_amount",
                "unposted_invoice_count",
                "unposted_invoice_amount",
                "open_invoice_amount"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_AccountingEntryResponse": {
        "properties": {
          "data": {
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/LedgerEntryResponse",
                  "description": "The ledger entry, shaped exactly like `serialize_entry`."
                },
                {
                  "properties": {
                    "links": {
                      "description": "Accounting entry links (`accounting_entry_links`) for this entry.",
                      "items": {
                        "$ref": "#/components/schemas/AccountingEntryLinkResponse"
                      },
                      "type": "array"
                    },
                    "source_document_ids": {
                      "description": "The entry's own `source_document_id` (if any) followed by any\n`derived_from_document` link document ids, de-duplicated, order\npreserved.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "links",
                    "source_document_ids"
                  ],
                  "type": "object"
                }
              ]
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_AccountingSupplierRowResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "city": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "invoice_count": {
                  "format": "int64",
                  "type": "integer"
                },
                "last_invoice_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "open_invoice_amount": {
                  "format": "double",
                  "type": "number"
                },
                "open_invoice_count": {
                  "format": "int64",
                  "type": "integer"
                },
                "org_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "outstanding_amount": {
                  "format": "double",
                  "type": "number"
                },
                "settled_amount": {
                  "format": "double",
                  "type": "number"
                },
                "supplier_number": {
                  "format": "int32",
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "total_spend": {
                  "format": "double",
                  "type": "number"
                },
                "unposted_invoice_amount": {
                  "format": "double",
                  "type": "number"
                },
                "unposted_invoice_count": {
                  "format": "int64",
                  "type": "integer"
                }
              },
              "required": [
                "id",
                "name",
                "invoice_count",
                "open_invoice_count",
                "total_spend",
                "settled_amount",
                "outstanding_amount",
                "unposted_invoice_count",
                "unposted_invoice_amount",
                "open_invoice_amount"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_BankAccountRoutingRuleResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "bank_account_id": {
                  "type": "string"
                },
                "bank_account_label": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "ledger_account_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "provider": {
                  "type": "string"
                },
                "source_account_key": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "provider",
                "source_account_key",
                "bank_account_id",
                "bank_account_label",
                "currency"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_BankInfoResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "clearing_ranges": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "clearing_ranges"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_BankMatchingMatchResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "bank_transaction_id": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "match_confidence": {
                  "format": "double",
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "match_method": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "match_reasoning": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "matched_at": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "supplier_invoice_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "bank_transaction_id",
                "status",
                "matched_at"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_BureauDocumentResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "body": {
                  "type": "string"
                },
                "created_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "updated_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updated_by_email": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "title",
                "body"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_CardRuleResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "card_brand": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "card_last_four": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "credit_account": {
                  "format": "int32",
                  "type": "integer"
                },
                "id": {
                  "type": "string"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "person_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updated_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "card_last_four",
                "credit_account",
                "created_at",
                "updated_at"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_ChartAccountResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "account_category": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_class": {
                  "format": "int32",
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "account_name": {
                  "type": "string"
                },
                "account_number": {
                  "type": "string"
                },
                "account_subcategory": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "balance_brought_forward": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "balance_carried_forward": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "bas_account_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "bas_link_kind": {
                  "type": "string"
                },
                "currency_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "default_vat_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "is_active": {
                  "type": "boolean"
                },
                "is_company_specific": {
                  "type": "boolean"
                },
                "is_custom": {
                  "type": "boolean"
                },
                "last_synced_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "normal_balance": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "type": "string"
                },
                "source_provider": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sru_code": {
                  "format": "int32",
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "year": {
                  "format": "int32",
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              },
              "required": [
                "account_number",
                "bas_link_kind",
                "account_name",
                "is_active",
                "source",
                "is_company_specific",
                "is_custom"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_CompanyReferenceDocumentOut": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "byte_size": {
                  "format": "int32",
                  "type": "integer"
                },
                "content_hash": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "original_filename": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                },
                "visibility": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "title",
                "original_filename",
                "content_type",
                "status",
                "visibility",
                "content_hash",
                "byte_size",
                "created_at",
                "updated_at"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_CustomerInvoiceDeliveryResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "channel": {
                  "type": "string"
                },
                "company_id": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "error_message": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "failed_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "idempotency_key": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "invoice_id": {
                  "type": "string"
                },
                "metadata": {},
                "provider": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "provider_message_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "recipient_email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sender_email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sent_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "subject": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updated_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "company_id",
                "invoice_id",
                "channel",
                "status",
                "metadata",
                "created_at",
                "updated_at"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_CustomerInvoiceResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "accounting_method_snapshot": {
                  "type": "string"
                },
                "company_id": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "credited_invoice_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "currency": {
                  "type": "string"
                },
                "customer_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "delivery_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "document_type": {
                  "type": "string"
                },
                "due_date": {
                  "type": "string"
                },
                "entry_context": {},
                "fortnox_document_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "invoice_date": {
                  "type": "string"
                },
                "invoice_number": {
                  "type": "string"
                },
                "issue_entry_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "issued_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "items": {
                  "items": {
                    "$ref": "#/components/schemas/CustomerInvoiceItemResponse"
                  },
                  "type": "array"
                },
                "last_settlement_entry_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "our_reference": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "paid_amount": {
                  "format": "double",
                  "type": "number"
                },
                "paid_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "payment_reference": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "payment_terms_days": {
                  "format": "int32",
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "price_includes_vat": {
                  "type": "boolean"
                },
                "reference_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reference_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "remaining_amount": {
                  "format": "double",
                  "type": "number"
                },
                "reverse_charge_text": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sent_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source_document_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "subtotal": {
                  "format": "double",
                  "type": "number"
                },
                "total": {
                  "format": "double",
                  "type": "number"
                },
                "updated_at": {
                  "type": "string"
                },
                "vat_amount": {
                  "format": "double",
                  "type": "number"
                },
                "vat_treatment": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "your_reference": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "company_id",
                "invoice_number",
                "status",
                "document_type",
                "accounting_method_snapshot",
                "invoice_date",
                "due_date",
                "price_includes_vat",
                "currency",
                "subtotal",
                "vat_amount",
                "total",
                "paid_amount",
                "remaining_amount",
                "entry_context",
                "created_at",
                "updated_at",
                "items"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_CustomerInvoiceTimelineEvent": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "data": {
                  "description": "Event-type-specific payload. Keys differ per `event_type`; money\nvalues are JSON numbers (FastAPI `Decimal` \u2192 float).",
                  "type": "object"
                },
                "document_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "effective_date": {
                  "description": "The accounting-effective date (`YYYY-MM-DD`) the timeline sorts on.",
                  "type": "string"
                },
                "event_type": {
                  "type": "string"
                },
                "invoice_id": {
                  "description": "`null` only for a ledger link whose `related_resource_id` is unset.",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "invoice_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "occurred_at": {
                  "description": "`created_at` of the underlying row, ISO `+00:00`.",
                  "type": "string"
                },
                "status": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "event_type",
                "occurred_at",
                "effective_date",
                "data"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_EmployeeExpenseResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "amount": {
                  "format": "double",
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "extracted_text": {
                  "type": "string"
                },
                "file_type": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "original_filename": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "s3_key": {
                  "type": "string"
                },
                "view_url": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "s3_key",
                "file_type",
                "extracted_text",
                "created_at",
                "description",
                "view_url"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_EmployeeResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "account_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "address1": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "address2": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "auto_non_recurring_tax": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "bank_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "card_last_four": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "card_rule_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "city": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "clearing_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "cost_center": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string"
                },
                "dated_schedules": {
                  "items": {},
                  "type": "array"
                },
                "dated_wages": {
                  "items": {},
                  "type": "array"
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "employed_to": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "employee_categories": {
                  "items": {},
                  "type": "array"
                },
                "employment_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "employment_form": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "first_name": {
                  "type": "string"
                },
                "fortnox_employee_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_last_synced_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_payload": {},
                "fortnox_sync_error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_sync_status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "full_time_equivalent": {
                  "format": "double",
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "gross_salary": {
                  "format": "double",
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "hourly_rate": {
                  "format": "double",
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "last_name": {
                  "type": "string"
                },
                "non_recurring_tax": {
                  "format": "double",
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "payslip_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "personel_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "personnummer": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "phone1": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "phone2": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "post_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "preliminary_tax_deducted": {
                  "format": "double",
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "profile_picture_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "project": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "role": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "salary_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "schedule_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sensitive_fields_redacted": {
                  "type": "boolean"
                },
                "setup_status": {
                  "type": "string"
                },
                "setup_step": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "tax_allowance": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "tax_column": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "tax_table": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updated_at": {
                  "type": "string"
                },
                "vacation_intent": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "working_time_enumeration": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "first_name",
                "last_name",
                "dated_wages",
                "dated_schedules",
                "employee_categories",
                "setup_status",
                "created_at",
                "updated_at",
                "sensitive_fields_redacted"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_EnableBankingAspspResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "beta": {
                  "type": "boolean"
                },
                "bic": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country": {
                  "type": "string"
                },
                "logo": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "maximum_consent_validity": {
                  "format": "int64",
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "psu_types": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "required_psu_headers": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                }
              },
              "required": [
                "name",
                "country",
                "psu_types",
                "maximum_consent_validity",
                "beta",
                "required_psu_headers"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_FiscalPeriodResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "closed_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "closed_by": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "company_id": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "is_closed": {
                  "type": "boolean"
                },
                "is_locked": {
                  "type": "boolean"
                },
                "opening_balance_entry_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "opening_balances_set": {
                  "type": "boolean"
                },
                "period_end": {
                  "type": "string"
                },
                "period_start": {
                  "type": "string"
                },
                "result_transfer_entry_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "company_id",
                "period_start",
                "period_end",
                "is_locked",
                "is_closed",
                "opening_balances_set"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_FortnoxEmployeeResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "created_at": {
                  "type": "string"
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "employed_to": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "employment_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "first_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_employee_id": {
                  "type": "string"
                },
                "fortnox_payload": {},
                "full_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hourly_pay": {
                  "format": "double",
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "inactive": {
                  "type": "boolean"
                },
                "job_title": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "last_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "last_synced_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "local_employee_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "monthly_salary": {
                  "format": "double",
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "personal_identity_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "phone1": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "phone2": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "salary_form": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "schedule_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updated_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "fortnox_employee_id",
                "inactive",
                "fortnox_payload",
                "created_at",
                "updated_at"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_FortnoxSyncStatusResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "completed_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "error_message": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "records_synced": {
                  "format": "int32",
                  "type": "integer"
                },
                "started_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "sync_type": {
                  "type": "string"
                }
              },
              "required": [
                "sync_type",
                "status",
                "records_synced"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_LedgerEntryResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "base_amount": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "buyer_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "buyer_org_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "committed_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "company_id": {
                  "type": "string"
                },
                "corrected_by_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "correction_of_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "correction_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "currency_unit": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "customer_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "customer_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "document_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "document_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "entry_context": {},
                "entry_date": {
                  "type": "string"
                },
                "entry_kind": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "exchange_rate": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "exchange_rate_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "export_provider": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "exported_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "external_ref": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_archive_file_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_attachment_documents": {},
                "fortnox_attachment_error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_attachment_status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_attachment_verified_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_file_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fortnox_voucher_json": {},
                "fortnox_voucher_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "intent": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "invoice_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "lines": {
                  "items": {
                    "$ref": "#/components/schemas/LedgerLineResponse"
                  },
                  "type": "array"
                },
                "llm_description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "needs_input": {
                  "type": "boolean"
                },
                "original_amount": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "original_currency": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "payment_reference": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "posting_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "provider_links": {
                  "items": {
                    "$ref": "#/components/schemas/ProviderLinkResponse"
                  },
                  "type": "array"
                },
                "ready_to_post": {
                  "type": "boolean"
                },
                "reference_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reference_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reversed_by_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reverses_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source_document_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source_text": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "supplier_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updated_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updated_by_user_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "voucher_number": {
                  "format": "int32",
                  "type": "integer"
                },
                "voucher_series": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "company_id",
                "voucher_number",
                "voucher_series",
                "entry_date",
                "status",
                "needs_input",
                "ready_to_post",
                "entry_context",
                "provider_links",
                "fortnox_attachment_documents",
                "lines"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_PipelineRunResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "completed_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "document_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "error_message": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "graph_name": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "node_history": {
                  "items": {},
                  "type": "array"
                },
                "process_id": {
                  "type": "string"
                },
                "queries_log": {
                  "items": {},
                  "type": "array"
                },
                "stages": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "started_at": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "total_input_tokens": {
                  "format": "int32",
                  "type": "integer"
                },
                "total_output_tokens": {
                  "format": "int32",
                  "type": "integer"
                }
              },
              "required": [
                "id",
                "process_id",
                "graph_name",
                "stages",
                "status",
                "node_history",
                "queries_log",
                "total_input_tokens",
                "total_output_tokens",
                "started_at"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_ProviderConnectionResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "id": {
                  "format": "uuid",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "provider_id": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "voucher_series": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "provider_id",
                "status",
                "name",
                "voucher_series"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_ReferenceSourceOut": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "display_name": {
                  "type": "string"
                },
                "enabled": {
                  "type": "boolean"
                },
                "impact": {
                  "type": "string"
                },
                "ingestion_ease": {
                  "type": "string"
                },
                "jurisdiction": {
                  "type": "string"
                },
                "language": {
                  "type": "string"
                },
                "last_ingested_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "last_ingestion_status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "priority": {
                  "format": "int32",
                  "type": "integer"
                },
                "source_id": {
                  "type": "string"
                },
                "source_type": {
                  "type": "string"
                },
                "source_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status_label": {
                  "type": "string"
                },
                "topics": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "update_cadence": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "source_id",
                "source_type",
                "display_name",
                "jurisdiction",
                "language",
                "priority",
                "topics",
                "ingestion_ease",
                "impact",
                "status_label",
                "enabled"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_String": {
        "properties": {
          "data": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_SyncCostCenterResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "active": {
                  "type": "boolean"
                },
                "code": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "code",
                "active"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_SyncProjectResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "end_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "project_number": {
                  "type": "string"
                },
                "start_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "project_number"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_SyncSupplierResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "address": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "bankgiro": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "city": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "default_expense_account": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "is_active": {
                  "type": "boolean"
                },
                "name": {
                  "type": "string"
                },
                "org_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "plusgiro": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "supplier_number": {
                  "format": "int32",
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "supplier_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "vat_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "zip_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "is_active"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_TimeEntryResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "billable": {
                  "type": "boolean"
                },
                "billed": {
                  "type": "boolean"
                },
                "client_company_id": {
                  "format": "uuid",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "client_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "date": {
                  "format": "date",
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "duration": {
                  "format": "int32",
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "elapsed_seconds": {
                  "format": "int64",
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "id": {
                  "format": "uuid",
                  "type": "string"
                },
                "invoice_item_id": {
                  "format": "uuid",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "rate": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "start_time": {
                  "format": "date-time",
                  "type": "string"
                },
                "stop_time": {
                  "format": "date-time",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updated_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "user_id": {
                  "format": "uuid",
                  "type": "string"
                }
              },
              "required": [
                "id",
                "user_id",
                "start_time",
                "date",
                "billable",
                "billed",
                "currency",
                "created_at",
                "updated_at"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_Value": {
        "properties": {
          "data": {
            "items": {},
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiList_WagePeriodResponse": {
        "properties": {
          "data": {
            "items": {
              "properties": {
                "created_at": {
                  "type": "string"
                },
                "employee_id": {
                  "type": "string"
                },
                "hours_worked": {
                  "format": "double",
                  "minimum": 0,
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "other_costs": {
                  "format": "double",
                  "minimum": 0,
                  "type": "number"
                },
                "own_expenses": {
                  "format": "double",
                  "minimum": 0,
                  "type": "number"
                },
                "payslip_s3_key": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "period_month": {
                  "format": "int32",
                  "type": "integer"
                },
                "period_year": {
                  "format": "int32",
                  "type": "integer"
                },
                "raw_input_text": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "structured_data": {},
                "updated_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "employee_id",
                "period_year",
                "period_month",
                "own_expenses",
                "other_costs",
                "status",
                "created_at",
                "updated_at"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ApiVersion": {
        "enum": [
          "v1",
          "unsupported"
        ],
        "type": "string"
      },
      "AttachEntryDocumentRequest": {
        "properties": {
          "document_id": {
            "description": "The `documents.id` to attach to this entry.",
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "document_id"
        ],
        "type": "object"
      },
      "AuditEventResponse": {
        "properties": {
          "actor_type": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "details": {},
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "event_type": {
            "type": "string"
          },
          "hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "parent_event_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "previous_state": {},
          "user_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "event_type",
          "actor_type",
          "created_at"
        ],
        "type": "object"
      },
      "AuditLogListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/AuditEventResponse"
            },
            "type": "array"
          },
          "page": {
            "format": "int64",
            "type": "integer"
          },
          "page_size": {
            "format": "int64",
            "type": "integer"
          },
          "total": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "page_size"
        ],
        "type": "object"
      },
      "AutomationDetailResponse": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "entrypoint": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "items": {
              "$ref": "#/components/schemas/AutomationRunEventResponse"
            },
            "type": "array"
          },
          "file_count": {
            "format": "int64",
            "type": "integer"
          },
          "files": {
            "items": {
              "$ref": "#/components/schemas/AutomationFileResponse"
            },
            "type": "array"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "last_run": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AutomationRunResponse"
              }
            ]
          },
          "latest_version": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AutomationVersionResponse"
              }
            ]
          },
          "latest_version_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "run_count": {
            "format": "int64",
            "type": "integer"
          },
          "runs": {
            "items": {
              "$ref": "#/components/schemas/AutomationRunResponse"
            },
            "type": "array"
          },
          "runtime": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "staged_change_count": {
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "status",
          "file_count",
          "run_count",
          "staged_change_count",
          "files",
          "runs",
          "events"
        ],
        "type": "object"
      },
      "AutomationFileDownloadResponse": {
        "properties": {
          "content_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_in": {
            "format": "int64",
            "type": "integer"
          },
          "filename": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "expires_in",
          "filename"
        ],
        "type": "object"
      },
      "AutomationFileResponse": {
        "properties": {
          "content_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "filename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "purpose": {
            "type": "string"
          },
          "sha256": {
            "type": "string"
          },
          "size_bytes": {
            "format": "int64",
            "type": "integer"
          },
          "storage_key": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "filename",
          "size_bytes",
          "sha256",
          "purpose",
          "storage_key"
        ],
        "type": "object"
      },
      "AutomationListMeta": {
        "properties": {
          "count": {
            "minimum": 0,
            "type": "integer"
          },
          "limit": {
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "count",
          "limit",
          "status"
        ],
        "type": "object"
      },
      "AutomationListResponse": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/AutomationResponse"
            },
            "type": "array"
          },
          "meta": {
            "$ref": "#/components/schemas/AutomationListMeta"
          }
        },
        "required": [
          "data",
          "meta"
        ],
        "type": "object"
      },
      "AutomationProposalStageRequest": {
        "properties": {
          "proposal": {}
        },
        "type": "object"
      },
      "AutomationProposalStageResponse": {
        "properties": {
          "run": {
            "$ref": "#/components/schemas/AutomationRunResponse"
          },
          "staged_operations": {
            "items": {},
            "type": "array"
          },
          "validation": {}
        },
        "required": [
          "run",
          "staged_operations",
          "validation"
        ],
        "type": "object"
      },
      "AutomationResponse": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "entrypoint": {
            "type": [
              "string",
              "null"
            ]
          },
          "file_count": {
            "format": "int64",
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "last_run": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AutomationRunResponse"
              }
            ]
          },
          "latest_version_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "run_count": {
            "format": "int64",
            "type": "integer"
          },
          "runtime": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "staged_change_count": {
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "status",
          "file_count",
          "run_count",
          "staged_change_count"
        ],
        "type": "object"
      },
      "AutomationRunCreateRequest": {
        "properties": {
          "origin": {
            "type": "string"
          },
          "staged_operation_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "summary": {},
          "version_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "AutomationRunEventCreateRequest": {
        "properties": {
          "event_type": {
            "type": "string"
          },
          "level": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "payload": {}
        },
        "required": [
          "event_type",
          "message"
        ],
        "type": "object"
      },
      "AutomationRunEventResponse": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "event_type": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "level": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "payload": {}
        },
        "required": [
          "id",
          "level",
          "event_type",
          "message",
          "payload"
        ],
        "type": "object"
      },
      "AutomationRunResponse": {
        "properties": {
          "automation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "completed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "duration_ms": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "error": {},
          "exit_code": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "operation_count": {
            "format": "int32",
            "type": "integer"
          },
          "origin": {
            "type": "string"
          },
          "staged_operation_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "started_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "summary": {},
          "updated_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "version_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "origin",
          "status",
          "operation_count",
          "staged_operation_ids",
          "summary"
        ],
        "type": "object"
      },
      "AutomationRunUpdateRequest": {
        "properties": {
          "duration_ms": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "error": {},
          "exit_code": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "operation_count": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "staged_operation_ids": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {}
        },
        "type": "object"
      },
      "AutomationVersionResponse": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "entrypoint": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "manifest": {},
          "runtime": {
            "type": "string"
          },
          "source_hash": {
            "type": "string"
          },
          "validation": {},
          "version_number": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "version_number",
          "entrypoint",
          "runtime",
          "source_hash",
          "manifest",
          "validation"
        ],
        "type": "object"
      },
      "BankAccountResponse": {
        "properties": {
          "account_label": {
            "type": "string"
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_name": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "ledger_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_account_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_provider": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "bank_name",
          "account_label",
          "currency"
        ],
        "type": "object"
      },
      "BankAccountRoutingRuleResponse": {
        "properties": {
          "bank_account_id": {
            "type": "string"
          },
          "bank_account_label": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "ledger_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider": {
            "type": "string"
          },
          "source_account_key": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "provider",
          "source_account_key",
          "bank_account_id",
          "bank_account_label",
          "currency"
        ],
        "type": "object"
      },
      "BankAccountsData": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/BankAccountResponse"
            },
            "type": "array"
          },
          "summary": {
            "$ref": "#/components/schemas/BankAccountsSummary"
          }
        },
        "required": [
          "items",
          "summary"
        ],
        "type": "object"
      },
      "BankAccountsSummary": {
        "properties": {
          "count": {
            "minimum": 0,
            "type": "integer"
          },
          "missing_ledger_mapping_count": {
            "minimum": 0,
            "type": "integer"
          },
          "source_provider": {
            "description": "Echoes the query-param filter so terminal renderers can show which\nfilter applied without re-parsing the request.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "count",
          "missing_ledger_mapping_count"
        ],
        "type": "object"
      },
      "BankInfoResponse": {
        "properties": {
          "clearing_ranges": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "clearing_ranges"
        ],
        "type": "object"
      },
      "BankMatchRejectResponse": {
        "properties": {
          "audit_event_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "bank_transaction_id": {
            "type": "string"
          },
          "entity_id": {
            "type": "string"
          },
          "entity_type": {
            "type": "string"
          },
          "match_id": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "operation_status": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "supplier_invoice_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "verification": {},
          "warnings": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "match_id",
          "bank_transaction_id",
          "status",
          "operation",
          "operation_status",
          "entity_type",
          "entity_id",
          "verification",
          "warnings",
          "audit_event_ids"
        ],
        "type": "object"
      },
      "BankMatchResponse": {
        "properties": {
          "bank_transaction": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BankTransactionResponse"
              }
            ]
          },
          "bank_transaction_id": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "match_confidence": {
            "type": [
              "string",
              "null"
            ]
          },
          "match_method": {
            "type": [
              "string",
              "null"
            ]
          },
          "match_reasoning": {
            "type": [
              "string",
              "null"
            ]
          },
          "matched_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_entry": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PaymentEntrySummaryResponse"
              }
            ]
          },
          "payment_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "supplier_invoice": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SupplierInvoiceResponse"
              }
            ]
          },
          "supplier_invoice_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "bank_transaction_id",
          "status"
        ],
        "type": "object"
      },
      "BankMatchesShowData": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/BankMatchResponse"
            },
            "type": "array"
          },
          "summary": {
            "$ref": "#/components/schemas/BankMatchesShowSummary"
          }
        },
        "required": [
          "items",
          "summary"
        ],
        "type": "object"
      },
      "BankMatchesShowSummary": {
        "properties": {
          "count": {
            "minimum": 0,
            "type": "integer"
          },
          "payment_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplier_invoice_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "count"
        ],
        "type": "object"
      },
      "BankMatchesSummaryData": {
        "description": "Top-level payload \u2014 `summary` block + per-account list.",
        "properties": {
          "bank_accounts": {
            "items": {
              "$ref": "#/components/schemas/AccountSummaryResponse"
            },
            "type": "array"
          },
          "summary": {
            "$ref": "#/components/schemas/GlobalSummary"
          }
        },
        "required": [
          "summary",
          "bank_accounts"
        ],
        "type": "object"
      },
      "BankMatchingMatchResponse": {
        "properties": {
          "bank_transaction_id": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "match_confidence": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "match_method": {
            "type": [
              "string",
              "null"
            ]
          },
          "match_reasoning": {
            "type": [
              "string",
              "null"
            ]
          },
          "matched_at": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "supplier_invoice_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "bank_transaction_id",
          "status",
          "matched_at"
        ],
        "type": "object"
      },
      "BankMatchingRunResponse": {
        "properties": {
          "audit_event_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "auto_approved": {
            "format": "int64",
            "type": "integer"
          },
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "matches_found": {
            "format": "int64",
            "type": "integer"
          },
          "operation": {
            "type": [
              "string",
              "null"
            ]
          },
          "operation_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "preview": {},
          "queries_log": {
            "items": {},
            "type": "array"
          },
          "total_transactions": {
            "format": "int64",
            "type": "integer"
          },
          "unmatched": {
            "format": "int64",
            "type": "integer"
          },
          "verification": {},
          "warnings": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "total_transactions",
          "matches_found",
          "auto_approved",
          "unmatched",
          "queries_log",
          "verification",
          "warnings",
          "audit_event_ids"
        ],
        "type": "object"
      },
      "BankTransactionAccountListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/BankTransactionAccountResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "BankTransactionAccountResponse": {
        "properties": {
          "account_label": {
            "type": "string"
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_name": {
            "type": "string"
          },
          "bankgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "bban": {
            "type": [
              "string",
              "null"
            ]
          },
          "bic": {
            "type": [
              "string",
              "null"
            ]
          },
          "cash_account_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "clearing_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "holder_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "iban": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "ledger_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "product": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_account_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_provider": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "bank_name",
          "account_label",
          "currency",
          "created_at"
        ],
        "type": "object"
      },
      "BankTransactionImportDerivedColumnResponse": {
        "properties": {
          "derived_column": {
            "type": "string"
          },
          "detected_currencies": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "maps_to_original_currency": {
            "type": "boolean"
          },
          "source_column": {
            "type": "string"
          }
        },
        "required": [
          "source_column",
          "derived_column",
          "maps_to_original_currency",
          "detected_currencies"
        ],
        "type": "object"
      },
      "BankTransactionImportListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/BankTransactionImportResponse"
            },
            "type": "array"
          },
          "page": {
            "format": "int64",
            "type": "integer"
          },
          "page_size": {
            "format": "int64",
            "type": "integer"
          },
          "total": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "page_size"
        ],
        "type": "object"
      },
      "BankTransactionImportPreviewIssueResponse": {
        "properties": {
          "code": {
            "type": "string"
          },
          "column": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          },
          "row_number": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "BankTransactionImportPreviewResponse": {
        "properties": {
          "columns": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "derived_columns": {
            "items": {
              "$ref": "#/components/schemas/BankTransactionImportDerivedColumnResponse"
            },
            "type": "array"
          },
          "duplicate_count": {
            "format": "int32",
            "type": "integer"
          },
          "issues": {
            "items": {
              "$ref": "#/components/schemas/BankTransactionImportPreviewIssueResponse"
            },
            "type": "array"
          },
          "new_count": {
            "format": "int32",
            "type": "integer"
          },
          "preview_rows": {
            "items": {
              "$ref": "#/components/schemas/BankTransactionImportPreviewRowResponse"
            },
            "type": "array"
          },
          "requires_column_mapping": {
            "type": "boolean"
          },
          "requires_mapping": {
            "type": "boolean"
          },
          "row_count": {
            "format": "int32",
            "type": "integer"
          },
          "sample_rows": {
            "items": {
              "additionalProperties": {
                "type": "string"
              },
              "propertyNames": {
                "type": "string"
              },
              "type": "object"
            },
            "type": "array"
          },
          "source_accounts": {
            "items": {
              "$ref": "#/components/schemas/BankTransactionImportSourceAccountResponse"
            },
            "type": "array"
          },
          "suggested_column_mapping": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImportColumnMapping"
              }
            ]
          }
        },
        "required": [
          "row_count",
          "new_count",
          "duplicate_count",
          "source_accounts",
          "requires_mapping",
          "requires_column_mapping",
          "columns",
          "sample_rows",
          "preview_rows",
          "issues",
          "derived_columns"
        ],
        "type": "object"
      },
      "BankTransactionImportPreviewRowResponse": {
        "properties": {
          "account_label": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          },
          "balance": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_name": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "mapping_status": {
            "type": "string"
          },
          "row_number": {
            "format": "int32",
            "type": "integer"
          },
          "source_account_key": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "transaction_date": {
            "type": "string"
          }
        },
        "required": [
          "row_number",
          "transaction_date",
          "bank_name",
          "account_label",
          "description",
          "amount",
          "currency",
          "source_account_key",
          "mapping_status",
          "status"
        ],
        "type": "object"
      },
      "BankTransactionImportResponse": {
        "properties": {
          "account": {
            "$ref": "#/components/schemas/BankTransactionAccountResponse"
          },
          "account_id": {
            "type": "string"
          },
          "date_from": {
            "type": [
              "string",
              "null"
            ]
          },
          "date_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "duplicate_count": {
            "format": "int32",
            "type": "integer"
          },
          "filename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "imported_at": {
            "type": "string"
          },
          "new_count": {
            "format": "int32",
            "type": "integer"
          },
          "row_count": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "account_id",
          "filename",
          "row_count",
          "new_count",
          "duplicate_count",
          "imported_at",
          "account"
        ],
        "type": "object"
      },
      "BankTransactionImportResultResponse": {
        "properties": {
          "date_from": {
            "type": [
              "string",
              "null"
            ]
          },
          "date_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "duplicate_count": {
            "format": "int32",
            "type": "integer"
          },
          "import_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "import_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "new_count": {
            "format": "int32",
            "type": "integer"
          },
          "row_count": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "import_ids",
          "row_count",
          "new_count",
          "duplicate_count"
        ],
        "type": "object"
      },
      "BankTransactionImportSourceAccountResponse": {
        "properties": {
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_account_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "duplicate_count": {
            "format": "int32",
            "type": "integer"
          },
          "example_card_last_four": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "example_cards": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "iban": {
            "type": [
              "string",
              "null"
            ]
          },
          "label": {
            "type": "string"
          },
          "ledger_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "mapped": {
            "type": "boolean"
          },
          "mapping_status": {
            "type": "string"
          },
          "new_count": {
            "format": "int32",
            "type": "integer"
          },
          "provider": {
            "type": "string"
          },
          "row_count": {
            "format": "int32",
            "type": "integer"
          },
          "source_account_key": {
            "type": "string"
          }
        },
        "required": [
          "provider",
          "source_account_key",
          "display_name",
          "label",
          "currency",
          "row_count",
          "new_count",
          "duplicate_count",
          "mapped",
          "mapping_status",
          "example_cards",
          "example_card_last_four"
        ],
        "type": "object"
      },
      "BankTransactionListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/BankTransactionRouteResponse"
            },
            "type": "array"
          },
          "page": {
            "format": "int64",
            "type": "integer"
          },
          "page_size": {
            "format": "int64",
            "type": "integer"
          },
          "total": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "page_size"
        ],
        "type": "object"
      },
      "BankTransactionPlatformDetailResponse": {
        "properties": {
          "category": {
            "type": "string"
          },
          "charge_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "fee_amount": {
            "type": "string"
          },
          "fee_details": {
            "items": {
              "$ref": "#/components/schemas/BankTransactionPlatformFeeDetailResponse"
            },
            "type": "array"
          },
          "gross_amount": {
            "type": "string"
          },
          "net_amount": {
            "type": "string"
          },
          "presentment_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "presentment_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "provider_id",
          "category",
          "status",
          "gross_amount",
          "fee_amount",
          "net_amount",
          "fee_details"
        ],
        "type": "object"
      },
      "BankTransactionPlatformFeeDetailResponse": {
        "properties": {
          "amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "BankTransactionResponse": {
        "properties": {
          "amount": {
            "type": "string"
          },
          "bank_account": {
            "$ref": "#/components/schemas/BankAccountResponse"
          },
          "counterparty": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "reconciliation_status": {
            "type": "string"
          },
          "transaction_date": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "transaction_date",
          "description",
          "amount",
          "currency",
          "reconciliation_status",
          "bank_account"
        ],
        "type": "object"
      },
      "BankTransactionRouteResponse": {
        "properties": {
          "account_id": {
            "type": "string"
          },
          "account_label": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          },
          "balance": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance_is_estimated": {
            "type": "boolean"
          },
          "bank_name": {
            "type": "string"
          },
          "counterparty": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "import_id": {
            "type": "string"
          },
          "match_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "matched_document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "platform_detail": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BankTransactionPlatformDetailResponse"
              }
            ]
          },
          "reconciliation_status": {
            "type": "string"
          },
          "transaction_date": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "account_id",
          "import_id",
          "bank_name",
          "account_label",
          "transaction_date",
          "description",
          "amount",
          "currency",
          "balance_is_estimated",
          "reconciliation_status"
        ],
        "type": "object"
      },
      "BankTransactionShowData": {
        "properties": {
          "amount": {
            "type": "string"
          },
          "bank_account": {
            "$ref": "#/components/schemas/BankAccountResponse"
          },
          "counterparty": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "linked_entries": {
            "items": {
              "$ref": "#/components/schemas/LinkedEntryResponse"
            },
            "type": "array"
          },
          "linked_entry_count": {
            "minimum": 0,
            "type": "integer"
          },
          "matches": {
            "items": {
              "$ref": "#/components/schemas/BankMatchResponse"
            },
            "type": "array"
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "reconciliation_status": {
            "type": "string"
          },
          "transaction_date": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "transaction_date",
          "description",
          "amount",
          "currency",
          "reconciliation_status",
          "bank_account",
          "matches",
          "linked_entries",
          "linked_entry_count"
        ],
        "type": "object"
      },
      "BankTransactionsSearchData": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/BankTransactionResponse"
            },
            "type": "array"
          },
          "summary": {
            "$ref": "#/components/schemas/BankTransactionsSearchSummary"
          }
        },
        "required": [
          "items",
          "summary"
        ],
        "type": "object"
      },
      "BankTransactionsSearchSummary": {
        "properties": {
          "abs_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount_max": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount_min": {
            "type": [
              "string",
              "null"
            ]
          },
          "count": {
            "minimum": 0,
            "type": "integer"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "from_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_more": {
            "type": "boolean"
          },
          "inflow_sum": {
            "description": "Sum of `amount` over rows with amount > 0. 2-dp string.",
            "type": "string"
          },
          "limit": {
            "format": "int64",
            "type": "integer"
          },
          "next_offset": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "offset": {
            "format": "int64",
            "type": "integer"
          },
          "outflow_sum": {
            "description": "Sum of `|amount|` over rows with amount < 0. 2-dp string.",
            "type": "string"
          },
          "query": {
            "description": "Echo of the normalised query (None when empty after trimming).",
            "type": [
              "string",
              "null"
            ]
          },
          "reconciliation_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "returned_count": {
            "minimum": 0,
            "type": "integer"
          },
          "signed_sum": {
            "description": "Sum of every row's amount, signed. Decimal as 2-dp string.",
            "type": "string"
          },
          "to_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "format": "int64",
            "type": "integer"
          },
          "total_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "count",
          "returned_count",
          "total",
          "total_count",
          "signed_sum",
          "outflow_sum",
          "inflow_sum",
          "offset",
          "limit",
          "has_more"
        ],
        "type": "object"
      },
      "BasDatasetVersion": {
        "properties": {
          "bas_version": {
            "format": "int32",
            "type": "integer"
          },
          "generated_pack_version": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_runtime_default": {
            "type": "boolean"
          },
          "licence_clearance": {
            "type": "string"
          },
          "source_revision": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "bas_version",
          "licence_clearance",
          "is_runtime_default"
        ],
        "type": "object"
      },
      "BjornlundenConnectRequest": {
        "properties": {
          "client_id": {
            "type": "string"
          },
          "client_secret": {
            "type": "string"
          },
          "user_key": {
            "type": "string"
          }
        },
        "required": [
          "client_id",
          "client_secret",
          "user_key"
        ],
        "type": "object"
      },
      "BokioConnectRequest": {
        "properties": {
          "api_token": {
            "type": "string"
          },
          "company_id": {
            "type": "string"
          }
        },
        "required": [
          "api_token",
          "company_id"
        ],
        "type": "object"
      },
      "BrioxConnectRequest": {
        "properties": {
          "application_token": {
            "type": "string"
          }
        },
        "required": [
          "application_token"
        ],
        "type": "object"
      },
      "BrowserAgentArtifactListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/BrowserAgentArtifactResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "BrowserAgentArtifactResponse": {
        "properties": {
          "connection_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "content_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "content_length": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "content_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "inferred_supplier_confidence": {
            "type": [
              "string",
              "null"
            ]
          },
          "inferred_supplier_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "issued_at": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "matched_bank_transaction_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "original_filename": {
            "type": "string"
          },
          "run_id": {
            "format": "uuid",
            "type": "string"
          },
          "seller_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_domain": {
            "type": "string"
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "total_amount": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "run_id",
          "source_domain",
          "matched_bank_transaction_ids",
          "original_filename",
          "status"
        ],
        "type": "object"
      },
      "BrowserAgentBankSuggestionResponse": {
        "properties": {
          "bank_transaction_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "candidate_domain": {
            "type": [
              "string",
              "null"
            ]
          },
          "candidate_supplier_name": {
            "type": "string"
          },
          "confidence": {
            "format": "double",
            "type": "number"
          },
          "latest_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": "string"
          },
          "requires_user_confirmation": {
            "type": "boolean"
          },
          "suggested_recipe": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_amount": {
            "type": "string"
          },
          "transaction_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "candidate_supplier_name",
          "confidence",
          "reason",
          "bank_transaction_ids",
          "transaction_count",
          "total_amount",
          "requires_user_confirmation"
        ],
        "type": "object"
      },
      "BrowserAgentBankSuggestionsResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/BrowserAgentBankSuggestionResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "BrowserAgentConnectionCreateRequest": {
        "properties": {
          "account_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "allowed_domains": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "bank_transaction_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry_route": {
            "type": "string"
          },
          "new_account": {
            "type": "boolean"
          },
          "provider_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "BrowserAgentConnectionListResponse": {
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/BrowserAgentConnectionResponse"
            },
            "type": "array"
          },
          "readiness": {
            "$ref": "#/components/schemas/BrowserAgentReadiness"
          }
        },
        "required": [
          "enabled",
          "readiness",
          "items"
        ],
        "type": "object"
      },
      "BrowserAgentConnectionResponse": {
        "properties": {
          "account_key": {
            "type": "string"
          },
          "account_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "allowed_domains": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "auth_mode": {
            "type": "string"
          },
          "auth_only": {
            "type": "boolean"
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": "string"
          },
          "entry_route": {
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "last_run_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "last_verified_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "primary_domain": {
            "type": "string"
          },
          "provider_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "display_name",
          "account_key",
          "entry_route",
          "primary_domain",
          "allowed_domains",
          "status",
          "auth_mode",
          "auth_only"
        ],
        "type": "object"
      },
      "BrowserAgentLlmReadiness": {
        "properties": {
          "model": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        },
        "required": [
          "provider",
          "model",
          "source"
        ],
        "type": "object"
      },
      "BrowserAgentReadiness": {
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "llm": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BrowserAgentLlmReadiness"
              }
            ]
          },
          "missing": {
            "items": {
              "$ref": "#/components/schemas/BrowserAgentReadinessIssue"
            },
            "type": "array"
          },
          "ready": {
            "type": "boolean"
          },
          "run_ready": {
            "type": "boolean"
          },
          "runtime": {
            "$ref": "#/components/schemas/BrowserAgentRuntimeReadiness"
          },
          "setup_ready": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled",
          "setup_ready",
          "run_ready",
          "ready",
          "runtime",
          "missing"
        ],
        "type": "object"
      },
      "BrowserAgentReadinessIssue": {
        "properties": {
          "capability": {
            "type": "string"
          },
          "env": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "capability",
          "env",
          "reason"
        ],
        "type": "object"
      },
      "BrowserAgentRunCreateRequest": {
        "properties": {
          "bank_transaction_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "date_from": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "date_to": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "max_cost_usd": {
            "type": [
              "string",
              "null"
            ]
          },
          "requested_routes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "BrowserAgentRunCreateResponse": {
        "properties": {
          "run": {
            "$ref": "#/components/schemas/BrowserAgentRunResponse"
          }
        },
        "required": [
          "run"
        ],
        "type": "object"
      },
      "BrowserAgentRunResponse": {
        "properties": {
          "connection_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "date_from": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "date_to": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "error_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "finished_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "live_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "llm_model_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "llm_provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "max_cost_usd": {
            "type": [
              "string",
              "null"
            ]
          },
          "model_actual": {
            "type": [
              "string",
              "null"
            ]
          },
          "model_requested": {
            "type": [
              "string",
              "null"
            ]
          },
          "output": {},
          "readiness_snapshot": {},
          "request_kind": {
            "type": "string"
          },
          "runtime_session_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "started_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "step_count": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "total_cost_usd": {
            "type": [
              "string",
              "null"
            ]
          },
          "workflow_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "request_kind",
          "status",
          "readiness_snapshot",
          "output"
        ],
        "type": "object"
      },
      "BrowserAgentRuntimeReadiness": {
        "properties": {
          "provider": {
            "type": "string"
          },
          "run_mode": {
            "type": "string"
          },
          "setup_mode": {
            "type": "string"
          }
        },
        "required": [
          "provider",
          "setup_mode",
          "run_mode"
        ],
        "type": "object"
      },
      "BrowserAgentSetupCompleteRequest": {
        "properties": {
          "setup_session_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "setup_session_id"
        ],
        "type": "object"
      },
      "BrowserAgentSetupCompleteResponse": {
        "properties": {
          "connection": {
            "$ref": "#/components/schemas/BrowserAgentConnectionResponse"
          },
          "ready": {
            "type": "boolean"
          },
          "setup_session": {
            "$ref": "#/components/schemas/BrowserAgentSetupSessionDetailsResponse"
          },
          "validation_result": {}
        },
        "required": [
          "connection",
          "setup_session",
          "ready",
          "validation_result"
        ],
        "type": "object"
      },
      "BrowserAgentSetupSessionDetailsResponse": {
        "properties": {
          "connection_id": {
            "format": "uuid",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "live_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "setup_start_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "validation_result": {}
        },
        "required": [
          "id",
          "connection_id",
          "status",
          "validation_result"
        ],
        "type": "object"
      },
      "BrowserAgentSetupSessionRequest": {
        "properties": {
          "return_live_url": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "BrowserAgentSetupSessionResponse": {
        "properties": {
          "connection": {
            "$ref": "#/components/schemas/BrowserAgentConnectionResponse"
          },
          "live_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "setup_session": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BrowserAgentSetupSessionDetailsResponse"
              }
            ]
          },
          "setup_session_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "connection",
          "setup_session_id"
        ],
        "type": "object"
      },
      "BrowserAgentSourceResolveRequest": {
        "properties": {
          "query": {
            "type": "string"
          }
        },
        "required": [
          "query"
        ],
        "type": "object"
      },
      "BrowserAgentSourceResolveResponse": {
        "properties": {
          "confidence": {
            "format": "double",
            "type": "number"
          },
          "connection": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BrowserAgentConnectionResponse"
              }
            ]
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "primary_domain": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "query": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "status",
          "query",
          "confidence",
          "reason"
        ],
        "type": "object"
      },
      "BrowserAgentSuggestedSiteResponse": {
        "properties": {
          "allowed_domains": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "auth_only": {
            "type": "boolean"
          },
          "connection": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BrowserAgentConnectionResponse"
              }
            ]
          },
          "connections": {
            "items": {
              "$ref": "#/components/schemas/BrowserAgentConnectionResponse"
            },
            "type": "array"
          },
          "display_name": {
            "type": "string"
          },
          "experimental": {
            "type": "boolean"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "primary_domain": {
            "type": "string"
          },
          "provider_key": {
            "type": "string"
          }
        },
        "required": [
          "provider_key",
          "display_name",
          "primary_domain",
          "allowed_domains",
          "experimental",
          "auth_only",
          "connections"
        ],
        "type": "object"
      },
      "BrowserAgentSuggestedSitesResponse": {
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/BrowserAgentSuggestedSiteResponse"
            },
            "type": "array"
          },
          "readiness": {
            "$ref": "#/components/schemas/BrowserAgentReadiness"
          }
        },
        "required": [
          "enabled",
          "readiness",
          "items"
        ],
        "type": "object"
      },
      "BureauDocumentCreateRequest": {
        "properties": {
          "body": {
            "description": "Markdown body. Optional on create; defaults to an empty document.",
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "title"
        ],
        "type": "object"
      },
      "BureauDocumentResponse": {
        "properties": {
          "body": {
            "type": "string"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_by_email": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "title",
          "body"
        ],
        "type": "object"
      },
      "BureauDocumentUpdateRequest": {
        "properties": {
          "body": {
            "description": "New markdown body. Omit to leave unchanged (an empty string clears it).",
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "description": "New title. Omit to leave unchanged.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "CandidateResponse": {
        "properties": {
          "bank_transaction": {
            "$ref": "#/components/schemas/BankTransactionResponse"
          },
          "candidate_id": {
            "type": "string"
          },
          "candidate_type": {
            "type": "string"
          },
          "confidence": {
            "type": "string"
          },
          "ledger_entry": {
            "$ref": "#/components/schemas/LedgerEntrySummaryResponse"
          },
          "match_checks": {
            "$ref": "#/components/schemas/MatchChecksResponse"
          },
          "reasons": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "score": {
            "type": "string"
          },
          "warnings": {
            "items": {
              "$ref": "#/components/schemas/CandidateWarningResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "candidate_id",
          "candidate_type",
          "score",
          "confidence",
          "reasons",
          "warnings",
          "bank_transaction",
          "ledger_entry",
          "match_checks"
        ],
        "type": "object"
      },
      "CandidateWarningResponse": {
        "properties": {
          "bank_transaction_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message",
          "bank_transaction_ids"
        ],
        "type": "object"
      },
      "CandidatesData": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/CandidateResponse"
            },
            "type": "array"
          },
          "summary": {
            "$ref": "#/components/schemas/CandidatesSummary"
          }
        },
        "required": [
          "items",
          "summary"
        ],
        "type": "object"
      },
      "CandidatesSummary": {
        "properties": {
          "available_candidate_count": {
            "minimum": 0,
            "type": "integer"
          },
          "candidate_count": {
            "minimum": 0,
            "type": "integer"
          },
          "from_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_more_transactions": {
            "type": "boolean"
          },
          "include_linked_entries": {
            "type": "boolean"
          },
          "ledger_scan_from": {
            "type": "string"
          },
          "ledger_scan_to": {
            "type": "string"
          },
          "ledger_status": {
            "type": "string"
          },
          "limit": {
            "format": "int64",
            "type": "integer"
          },
          "max_days": {
            "format": "int32",
            "type": "integer"
          },
          "min_score": {
            "type": "string"
          },
          "next_offset": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "offset": {
            "format": "int64",
            "type": "integer"
          },
          "query": {
            "type": [
              "string",
              "null"
            ]
          },
          "reconciliation_status": {
            "type": "string"
          },
          "scan_limit": {
            "format": "int64",
            "type": "integer"
          },
          "scanned_ledger_line_count": {
            "minimum": 0,
            "type": "integer"
          },
          "scanned_transaction_count": {
            "minimum": 0,
            "type": "integer"
          },
          "to_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "tolerance": {
            "type": "string"
          }
        },
        "required": [
          "candidate_count",
          "available_candidate_count",
          "scanned_transaction_count",
          "scanned_ledger_line_count",
          "offset",
          "limit",
          "scan_limit",
          "has_more_transactions",
          "ledger_scan_from",
          "ledger_scan_to",
          "reconciliation_status",
          "ledger_status",
          "max_days",
          "tolerance",
          "min_score",
          "include_linked_entries"
        ],
        "type": "object"
      },
      "CardRuleCreate": {
        "properties": {
          "card_brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "card_last_four": {
            "type": "string"
          },
          "credit_account": {
            "format": "int32",
            "type": "integer"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "person_name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "card_last_four",
          "credit_account"
        ],
        "type": "object"
      },
      "CardRuleResponse": {
        "properties": {
          "card_brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "card_last_four": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "credit_account": {
            "format": "int32",
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "person_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "card_last_four",
          "credit_account",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "CardRuleUpdate": {
        "properties": {
          "card_brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit_account": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "person_name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ChainVerificationResponse": {
        "properties": {
          "entries": {
            "format": "int64",
            "type": "integer"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "valid": {
            "type": "boolean"
          },
          "verification_scope": {
            "type": "string"
          }
        },
        "required": [
          "valid",
          "entries",
          "verification_scope"
        ],
        "type": "object"
      },
      "ChartAccountResponse": {
        "properties": {
          "account_category": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_class": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "account_name": {
            "type": "string"
          },
          "account_number": {
            "type": "string"
          },
          "account_subcategory": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance_brought_forward": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance_carried_forward": {
            "type": [
              "string",
              "null"
            ]
          },
          "bas_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "bas_link_kind": {
            "type": "string"
          },
          "currency_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "default_vat_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_active": {
            "type": "boolean"
          },
          "is_company_specific": {
            "type": "boolean"
          },
          "is_custom": {
            "type": "boolean"
          },
          "last_synced_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "normal_balance": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string"
          },
          "source_provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "sru_code": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "year": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "account_number",
          "bas_link_kind",
          "account_name",
          "is_active",
          "source",
          "is_company_specific",
          "is_custom"
        ],
        "type": "object"
      },
      "ClerkWebhookResponse": {
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "type": "object"
      },
      "CliAccountingEntryCreateStageRequest": {
        "properties": {
          "bank_transaction_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "bank_transaction_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "base_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "context": {
            "type": "object"
          },
          "customer": {
            "type": "object"
          },
          "customer_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "document_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry_date": {
            "format": "date",
            "type": "string"
          },
          "entry_kind": {
            "type": "string"
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "external_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "intent": {
            "type": "string"
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/AccountingEntryLineInput"
            },
            "type": "array"
          },
          "llm_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "source_document_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "source_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "source_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplier": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SupplierReference",
                "description": "Optional supplier attribution using the canonical supplier-reference contract."
              }
            ]
          },
          "voucher_series": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "intent",
          "entry_kind",
          "entry_date"
        ],
        "type": "object"
      },
      "CliAccountingEntryUpdateStageRequest": {
        "properties": {
          "bank_transaction_id": {
            "$ref": "#/components/schemas/Option_String"
          },
          "bank_transaction_ids": {
            "$ref": "#/components/schemas/Option_Vec_String"
          },
          "base_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "context": {
            "type": "object"
          },
          "context_patch": {
            "type": "object"
          },
          "customer": {
            "type": "object"
          },
          "customer_name": {
            "$ref": "#/components/schemas/Option_String"
          },
          "description": {
            "$ref": "#/components/schemas/Option_String"
          },
          "document_date": {
            "$ref": "#/components/schemas/Option_String"
          },
          "document_type": {
            "$ref": "#/components/schemas/Option_String"
          },
          "entry_date": {
            "$ref": "#/components/schemas/Option_String"
          },
          "entry_kind": {
            "$ref": "#/components/schemas/Option_String"
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_date": {
            "$ref": "#/components/schemas/Option_String"
          },
          "external_ref": {
            "$ref": "#/components/schemas/Option_String"
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "intent": {
            "$ref": "#/components/schemas/Option_String"
          },
          "invoice_number": {
            "$ref": "#/components/schemas/Option_String"
          },
          "lines": {
            "$ref": "#/components/schemas/Option_Vec_AccountingEntryLineInput"
          },
          "llm_description": {
            "$ref": "#/components/schemas/Option_String"
          },
          "original_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_currency": {
            "$ref": "#/components/schemas/Option_String"
          },
          "payment_reference": {
            "$ref": "#/components/schemas/Option_String"
          },
          "reference_number": {
            "$ref": "#/components/schemas/Option_String"
          },
          "reference_type": {
            "$ref": "#/components/schemas/Option_String"
          },
          "requires_approval": {
            "type": "boolean"
          },
          "source_document_id": {
            "$ref": "#/components/schemas/Option_String"
          },
          "source_document_ids": {
            "$ref": "#/components/schemas/Option_Vec_String"
          },
          "source_text": {
            "$ref": "#/components/schemas/Option_String"
          },
          "supplier_name": {
            "$ref": "#/components/schemas/Option_String"
          }
        },
        "type": "object"
      },
      "CliAccountingMemoRequest": {
        "properties": {
          "entry_date": {
            "format": "date",
            "type": "string"
          },
          "entry_kind": {
            "type": "string"
          },
          "generate_pdf": {
            "type": "boolean"
          },
          "intent": {
            "type": "string"
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/AccountingEntryLineInput"
            },
            "type": "array"
          },
          "memo": {
            "type": "string"
          },
          "post": {
            "type": "boolean"
          },
          "voucher_series": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "entry_date",
          "memo"
        ],
        "type": "object"
      },
      "CliBankLinkAllocation": {
        "description": "One allocation of a bank row to a ledger entry. `amount` is a decimal string\n(e.g. `\"-27600.00\"`); the batch's allocations must sum to the bank row amount.",
        "properties": {
          "amount": {
            "type": "string"
          },
          "entry_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "entry_id",
          "amount"
        ],
        "type": "object"
      },
      "CliChartAccountRenameRequest": {
        "properties": {
          "account_name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "account_name"
        ],
        "type": "object"
      },
      "CliEntity": {
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "id"
        ],
        "type": "object"
      },
      "CliLedgerBankLinkBatchStageRequest": {
        "description": "Request for `POST /cli/ledger/bank-link-batch/stage`: link ONE bank row to\nMANY ledger entries with explicit per-entry allocation amounts.",
        "properties": {
          "allocations": {
            "items": {
              "$ref": "#/components/schemas/CliBankLinkAllocation"
            },
            "type": "array"
          },
          "bank_transaction_id": {
            "format": "uuid",
            "type": "string"
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          }
        },
        "required": [
          "bank_transaction_id"
        ],
        "type": "object"
      },
      "CliLedgerBankLinkStageRequest": {
        "properties": {
          "bank_transaction_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "bank_transaction_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "CliLedgerCorrectStageRequest": {
        "properties": {
          "bank_transaction_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "correction_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/AccountingEntryLineInput"
            },
            "type": "array"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "CliLedgerPostBulkRequest": {
        "properties": {
          "apply": {
            "type": "boolean"
          },
          "continue_on_error": {
            "type": "boolean"
          },
          "entry_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "export_external": {
            "type": "boolean"
          },
          "idempotency_prefix": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "CliProblemDetails": {
        "properties": {
          "code": {
            "description": "Stable machine-readable error code.",
            "type": "string"
          },
          "detail": {
            "description": "Scrubbed public message safe to show to users and API clients.",
            "type": "string"
          },
          "doc_url": {
            "description": "Optional documentation link for the stable error code.",
            "type": [
              "string",
              "null"
            ]
          },
          "error_type": {
            "$ref": "#/components/schemas/ApiErrorType",
            "description": "Broad machine-readable error category."
          },
          "param": {
            "description": "Request parameter, header, path component, or body field associated with the error.",
            "type": [
              "string",
              "null"
            ]
          },
          "request_id": {
            "description": "Diagnostic support handle matching the `X-Request-Id` response header.",
            "type": "string"
          },
          "status": {
            "description": "HTTP status code generated by the route.",
            "format": "int32",
            "minimum": 0,
            "type": "integer"
          },
          "title": {
            "description": "Short stable summary for the problem type.",
            "type": "string"
          },
          "type": {
            "description": "URI reference for the stable public problem type.",
            "type": "string"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code",
          "error_type",
          "request_id"
        ],
        "type": "object"
      },
      "CliRegisterImportRequest": {
        "description": "Agent-facing register import request. The CSV is passed inline as text\n(agents assemble the body from an object-ref before calling). `dry_run`\ndefaults to `true` so a bare call never writes.",
        "properties": {
          "column_mapping": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "Optional explicit `canonical field \u2192 CSV header` mapping override.",
            "propertyNames": {
              "type": "string"
            },
            "type": [
              "object",
              "null"
            ]
          },
          "csv_text": {
            "description": "Raw CSV text (Fortnox supplier/customer register export).",
            "type": "string"
          },
          "dry_run": {
            "description": "When true (default), classify rows without writing.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "csv_text"
        ],
        "type": "object"
      },
      "CliSchemaCommand": {
        "properties": {
          "args": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "description": {
            "type": "string"
          },
          "mutating": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "mutating",
          "description"
        ],
        "type": "object"
      },
      "CliSchemaError": {
        "properties": {
          "code": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          }
        },
        "required": [
          "code",
          "retryable"
        ],
        "type": "object"
      },
      "CliSchemaResponse": {
        "properties": {
          "commands": {
            "items": {
              "$ref": "#/components/schemas/CliSchemaCommand"
            },
            "type": "array"
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/CliSchemaError"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "schema_version": {
            "type": "string"
          }
        },
        "required": [
          "schema_version",
          "name",
          "commands",
          "errors"
        ],
        "type": "object"
      },
      "CliStagedListData": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/CliStagedSummary"
            },
            "type": "array"
          },
          "meta": {
            "$ref": "#/components/schemas/CliStagedListMeta"
          }
        },
        "required": [
          "items",
          "meta"
        ],
        "type": "object"
      },
      "CliStagedListEnvelope": {
        "properties": {
          "blockers": {
            "items": {},
            "type": "array"
          },
          "command": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/CliStagedListData"
          },
          "operation_status": {
            "type": "string"
          },
          "schema_version": {
            "type": "string"
          },
          "suggested_actions": {
            "items": {},
            "type": "array"
          },
          "warnings": {
            "items": {},
            "type": "array"
          }
        },
        "required": [
          "schema_version",
          "command",
          "operation_status",
          "data",
          "blockers",
          "warnings",
          "suggested_actions"
        ],
        "type": "object"
      },
      "CliStagedListMeta": {
        "properties": {
          "active_statuses": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "count": {
            "minimum": 0,
            "type": "integer"
          },
          "default_filter": {
            "type": "string"
          },
          "distinct_entity_count": {
            "format": "int64",
            "type": "integer"
          },
          "has_more": {
            "type": "boolean"
          },
          "include_executed": {
            "type": "boolean"
          },
          "limit": {
            "format": "int64",
            "type": "integer"
          },
          "returned_count": {
            "minimum": 0,
            "type": "integer"
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "format": "int64",
            "type": "integer"
          },
          "total_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "count",
          "returned_count",
          "total",
          "total_count",
          "distinct_entity_count",
          "limit",
          "default_filter",
          "include_executed",
          "active_statuses",
          "has_more"
        ],
        "type": "object"
      },
      "CliStagedPreviewData": {
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/CliStagedPreviewMeta"
          },
          "rows": {
            "items": {
              "$ref": "#/components/schemas/CliStagedPreviewRow"
            },
            "type": "array"
          },
          "unprojected": {
            "items": {},
            "type": "array"
          }
        },
        "required": [
          "rows",
          "unprojected",
          "meta"
        ],
        "type": "object"
      },
      "CliStagedPreviewEnvelope": {
        "properties": {
          "blockers": {
            "items": {},
            "type": "array"
          },
          "command": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/CliStagedPreviewData"
          },
          "operation_status": {
            "type": "string"
          },
          "schema_version": {
            "type": "string"
          },
          "suggested_actions": {
            "items": {},
            "type": "array"
          },
          "warnings": {
            "items": {},
            "type": "array"
          }
        },
        "required": [
          "schema_version",
          "command",
          "operation_status",
          "data",
          "blockers",
          "warnings",
          "suggested_actions"
        ],
        "type": "object"
      },
      "CliStagedPreviewMeta": {
        "properties": {
          "account": {
            "type": [
              "string",
              "null"
            ]
          },
          "pending_count": {
            "minimum": 0,
            "type": "integer"
          },
          "projected_op_count": {
            "minimum": 0,
            "type": "integer"
          },
          "unprojected_op_count": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "pending_count",
          "projected_op_count",
          "unprojected_op_count"
        ],
        "type": "object"
      },
      "CliStagedPreviewRow": {
        "properties": {
          "account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_number": {
            "type": "string"
          },
          "net": {
            "type": "string"
          }
        },
        "required": [
          "account_number",
          "net"
        ],
        "type": "object"
      },
      "CliStagedShowEnvelope": {
        "properties": {
          "blockers": {
            "items": {},
            "type": "array"
          },
          "command": {
            "type": "string"
          },
          "data": {},
          "entity": {
            "$ref": "#/components/schemas/CliEntity"
          },
          "operation_status": {
            "type": "string"
          },
          "schema_version": {
            "type": "string"
          },
          "suggested_actions": {
            "items": {},
            "type": "array"
          },
          "warnings": {
            "items": {},
            "type": "array"
          }
        },
        "required": [
          "schema_version",
          "command",
          "operation_status",
          "entity",
          "data",
          "blockers",
          "warnings",
          "suggested_actions"
        ],
        "type": "object"
      },
      "CliStagedSummary": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "lifecycle": {
            "$ref": "#/components/schemas/StagedOperationLifecycle"
          },
          "max_effect": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "requires_approval": {
            "type": "boolean"
          },
          "risk_level": {
            "type": "string"
          },
          "short_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "short_id",
          "operation",
          "status",
          "risk_level",
          "requires_approval",
          "max_effect",
          "lifecycle",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "CliSupplierInvoiceCancelStageRequest": {
        "properties": {
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "CliSupplierInvoiceUpdateStageRequest": {
        "properties": {
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "remaining": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "CliVoucherSeriesCreateRequest": {
        "properties": {
          "as_of": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "code": {
            "description": "New series code, 1\u20135 uppercase alphanumeric characters (e.g. `X`).",
            "type": "string"
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "workflow_family": {
            "description": "Workflow family snake_case key (defaults to `general`).",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "code",
          "name"
        ],
        "type": "object"
      },
      "CliVoucherSeriesUpdateRequest": {
        "properties": {
          "active": {
            "description": "Activate/deactivate the series (omit to keep current state).",
            "type": [
              "boolean",
              "null"
            ]
          },
          "as_of": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "effective_from": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "New display name (omit to keep the current name).",
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "description": "Required human reason; recorded on the registry event audit trail.",
            "type": "string"
          },
          "workflow_family": {
            "description": "Reassign the workflow family (omit to keep current).",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "reason"
        ],
        "type": "object"
      },
      "CompanyIdHeader": {
        "properties": {
          "value": {
            "description": "Authenticated tenant scope selected by the caller.",
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "value"
        ],
        "type": "object"
      },
      "CompanyInvitationOut": {
        "properties": {
          "accepted_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "accepted_by_user_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "expires_at": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "invited_by_user_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string"
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "role",
          "status",
          "expires_at",
          "created_at"
        ],
        "type": "object"
      },
      "CompanyListOut": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/CompanyOut"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "CompanyMemberOut": {
        "properties": {
          "email": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "is_creator": {
            "type": "boolean"
          },
          "is_current_user": {
            "type": "boolean"
          },
          "joined_at": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "email",
          "role",
          "joined_at",
          "is_current_user",
          "is_creator"
        ],
        "type": "object"
      },
      "CompanyOut": {
        "description": "Canonical company response shared by the HTTP service and agent contracts.",
        "properties": {
          "accounting_method": {
            "type": [
              "string",
              "null"
            ]
          },
          "address_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "address_co": {
            "type": [
              "string",
              "null"
            ]
          },
          "address_postal_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "address_street": {
            "type": [
              "string",
              "null"
            ]
          },
          "bankgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "bic": {
            "type": [
              "string",
              "null"
            ]
          },
          "business_form": {
            "type": [
              "string",
              "null"
            ]
          },
          "business_form_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "county": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "employee_size_class": {
            "type": [
              "string",
              "null"
            ]
          },
          "employee_size_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "f_skatt_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "fiscal_year_start": {
            "type": [
              "string",
              "null"
            ]
          },
          "iban": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "legal_form": {
            "type": [
              "string",
              "null"
            ]
          },
          "municipality": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "ownership": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "plusgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "registration_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "scb_lookup_meta": {},
          "sector": {
            "type": [
              "string",
              "null"
            ]
          },
          "sender_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "sni_code_primary": {
            "type": [
              "string",
              "null"
            ]
          },
          "sni_codes": {
            "items": {},
            "type": "array"
          },
          "start_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          },
          "vat_metadata_evidence": {},
          "vat_metadata_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_registration_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_reporting_period": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_reporting_start": {
            "type": [
              "string",
              "null"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "vat_metadata_evidence",
          "sni_codes",
          "scb_lookup_meta",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "CompanyReferenceDocumentOut": {
        "properties": {
          "byte_size": {
            "format": "int32",
            "type": "integer"
          },
          "content_hash": {
            "type": "string"
          },
          "content_type": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "original_filename": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "visibility": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "original_filename",
          "content_type",
          "status",
          "visibility",
          "content_hash",
          "byte_size",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "CompanyTeamOut": {
        "properties": {
          "invitations": {
            "items": {
              "$ref": "#/components/schemas/CompanyInvitationOut"
            },
            "type": "array"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/CompanyMemberOut"
            },
            "type": "array"
          }
        },
        "required": [
          "members",
          "invitations"
        ],
        "type": "object"
      },
      "CompanyUsageResponse": {
        "properties": {
          "by_action": {
            "items": {
              "$ref": "#/components/schemas/UsageByActionResponse"
            },
            "type": "array"
          },
          "company_id": {
            "type": "string"
          },
          "company_name": {
            "type": "string"
          },
          "daily": {
            "items": {
              "$ref": "#/components/schemas/DailyUsageResponse"
            },
            "type": "array"
          },
          "days": {
            "format": "int64",
            "type": "integer"
          },
          "totals": {
            "$ref": "#/components/schemas/UsageTotalsResponse"
          }
        },
        "required": [
          "company_id",
          "company_name",
          "days",
          "totals",
          "by_action",
          "daily"
        ],
        "type": "object"
      },
      "ConfirmSupplierRuleRequest": {
        "properties": {
          "expense_account": {
            "description": "The cost/expense account (class 4-7) to debit for this supplier.",
            "type": "string"
          },
          "payable_account": {
            "description": "The liability account (class 2, e.g. 2440) credited as the supplier\npayable on the source entry. Optional \u2014 falls back to the standard\naccounts-payable account from the accounting context when absent.",
            "type": [
              "string",
              "null"
            ]
          },
          "vat_account": {
            "description": "The input-VAT account (class 26xx) observed on the source entry, if any.\nRecorded for transparency; the VAT line is still reconstructed from the\nstatutory VAT treatment at apply time.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "expense_account"
        ],
        "type": "object"
      },
      "ConfirmSupplierRuleResponse": {
        "properties": {
          "expense_account": {
            "type": "string"
          },
          "payable_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "vat_account": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "status",
          "expense_account"
        ],
        "type": "object"
      },
      "CreateBankAccountRequest": {
        "properties": {
          "account_label": {
            "type": "string"
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_name": {
            "type": "string"
          },
          "bankgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "bban": {
            "type": [
              "string",
              "null"
            ]
          },
          "bic": {
            "type": [
              "string",
              "null"
            ]
          },
          "cash_account_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "clearing_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "holder_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "iban": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "product": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_account_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_provider": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "bank_name",
          "account_label"
        ],
        "type": "object"
      },
      "CreateChartAccountRequest": {
        "properties": {
          "account_category": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_name": {
            "type": "string"
          },
          "account_number": {
            "type": "string"
          },
          "account_subcategory": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "default_vat_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "sru_code": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "account_number",
          "account_name"
        ],
        "type": "object"
      },
      "CreateCompanyRequest": {
        "additionalProperties": false,
        "properties": {
          "accounting_method": {
            "type": "string"
          },
          "address_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "address_co": {
            "type": [
              "string",
              "null"
            ]
          },
          "address_postal_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "address_street": {
            "type": [
              "string",
              "null"
            ]
          },
          "bankgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "bic": {
            "type": [
              "string",
              "null"
            ]
          },
          "business_form": {
            "type": "string"
          },
          "business_form_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "county": {
            "type": [
              "string",
              "null"
            ]
          },
          "employee_size_class": {
            "type": [
              "string",
              "null"
            ]
          },
          "employee_size_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "f_skatt_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "first_fiscal_year": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "first_period_end": {
            "type": [
              "string",
              "null"
            ]
          },
          "first_period_start": {
            "type": [
              "string",
              "null"
            ]
          },
          "fiscal_year_start": {
            "type": "string"
          },
          "iban": {
            "type": [
              "string",
              "null"
            ]
          },
          "municipality": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "ownership": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "plusgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "registration_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "scb_lookup_meta": {},
          "sector": {
            "type": [
              "string",
              "null"
            ]
          },
          "sni_code_primary": {
            "type": [
              "string",
              "null"
            ]
          },
          "sni_codes": {
            "items": {},
            "type": "array"
          },
          "stage": {
            "type": "boolean"
          },
          "start_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_metadata_evidence": {
            "type": "object"
          },
          "vat_metadata_source": {
            "type": "string"
          },
          "vat_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_registration_status": {
            "type": "string"
          },
          "vat_reporting_period": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_reporting_start": {
            "type": [
              "string",
              "null"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "name",
          "business_form",
          "accounting_method",
          "vat_registration_status",
          "vat_metadata_source",
          "vat_metadata_evidence"
        ],
        "type": "object"
      },
      "CreateInvoiceFromEntriesRequest": {
        "properties": {
          "due_date": {
            "format": "date",
            "type": "string"
          },
          "invoice_date": {
            "format": "date",
            "type": "string"
          },
          "time_entry_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "time_entry_ids",
          "invoice_date",
          "due_date"
        ],
        "type": "object"
      },
      "CreateInvoiceFromEntriesResponse": {
        "properties": {
          "invoice_id": {
            "format": "uuid",
            "type": "string"
          },
          "invoice_number": {
            "type": "string"
          }
        },
        "required": [
          "invoice_id",
          "invoice_number"
        ],
        "type": "object"
      },
      "CreateStagedOperationRequest": {
        "description": "Create-staged-operation request body. Every field matches the\nPython `create_staged_operation` payload contract at\n`backend/app/staged_operations/service.py:107-164`.\n\nRenamed key: callers send `operation` (the operation_key); the\nPython service reads `payload[\"operation\"]` and stores it as\n`operation_key`. We preserve that on the wire here.",
        "properties": {
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "entity_type": {
            "description": "Optional semantic entity scope.",
            "type": [
              "string",
              "null"
            ]
          },
          "execution_target": {
            "type": [
              "string",
              "null"
            ]
          },
          "idempotency_key": {
            "description": "Optional idempotency key. When supplied AND a prior operation\nexists with the same `(company_id, operation, idempotency_key)`,\nthe service returns the existing operation with\n`replayed = true` instead of creating a new one.",
            "type": [
              "string",
              "null"
            ]
          },
          "input": {
            "description": "JSONB-shaped opaque payload. Default empty object on the wire,\nmatching Python `payload.get(\"input\") or {}`."
          },
          "operation": {
            "description": "Required. The operation_key - `ledger_entries.post`,\n`bank_matching.approve`, etc.",
            "type": "string"
          },
          "preview": {},
          "requires_approval": {
            "description": "Defaults to `false` per Python\n(`payload.get(\"requires_approval\", False)`).",
            "type": "boolean"
          },
          "risk_level": {
            "description": "`\"low\" | \"standard\" | \"high\"`. Defaults to `\"standard\"` per\nPython (`payload.get(\"risk_level\", \"standard\")`).",
            "type": "string"
          },
          "verification": {},
          "warnings": {
            "description": "Default empty array, matching Python\n`payload.get(\"warnings\") or []`."
          }
        },
        "required": [
          "operation"
        ],
        "type": "object"
      },
      "CreateStagedOperationResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/StagedOperationResponse"
          },
          {
            "properties": {
              "replayed": {
                "description": "`true` iff the idempotency-key check matched an existing row\nand no new INSERT happened.",
                "type": "boolean"
              }
            },
            "required": [
              "replayed"
            ],
            "type": "object"
          }
        ],
        "description": "Wrapper around `StagedOperationResponse` that carries the\n`replayed` flag so callers can distinguish \"idempotency-replay hit\" from\n\"new operation\"."
      },
      "CustomerDetailResponse": {
        "properties": {
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "address2": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "comments": {
            "type": [
              "string",
              "null"
            ]
          },
          "cost_center": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "customer_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_address1": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_address2": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_country": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_phone1": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_phone2": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_zip_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_invoice": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_invoice_bcc": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_invoice_cc": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_offer": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_offer_bcc": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_offer_cc": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_order": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_order_bcc": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_order_cc": {
            "type": [
              "string",
              "null"
            ]
          },
          "emails": {
            "items": {
              "$ref": "#/components/schemas/CustomerEmailEntryResponse"
            },
            "type": "array"
          },
          "external_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "fax": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_customer_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "gln": {
            "type": [
              "string",
              "null"
            ]
          },
          "gln_delivery": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "invoice_administration_fee": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_discount": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "invoice_freight": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_remark": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_active": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "our_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone2": {
            "type": [
              "string",
              "null"
            ]
          },
          "price_list": {
            "type": [
              "string",
              "null"
            ]
          },
          "project": {
            "type": [
              "string",
              "null"
            ]
          },
          "sales_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "show_price_vat_included": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "terms_of_delivery": {
            "type": [
              "string",
              "null"
            ]
          },
          "terms_of_payment": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "visiting_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "visiting_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "visiting_country": {
            "type": [
              "string",
              "null"
            ]
          },
          "visiting_country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "visiting_zip_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "way_of_delivery": {
            "type": [
              "string",
              "null"
            ]
          },
          "www": {
            "type": [
              "string",
              "null"
            ]
          },
          "your_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "zip_code": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "emails",
          "is_active"
        ],
        "type": "object"
      },
      "CustomerEmailEntryResponse": {
        "properties": {
          "address": {
            "type": "string"
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "address"
        ],
        "type": "object"
      },
      "CustomerInput": {
        "properties": {
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": "object"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "partner_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_details": {
            "type": "object"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "zip_code": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "CustomerInvoiceCreateRequest": {
        "properties": {
          "currency": {
            "type": "string"
          },
          "customer": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CustomerInput"
              }
            ]
          },
          "delivery_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "document_type": {
            "type": "string"
          },
          "due_date": {
            "format": "date",
            "type": "string"
          },
          "entry_context": {
            "type": "object"
          },
          "invoice_date": {
            "format": "date",
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/CustomerInvoiceItemUpdateRequest"
            },
            "type": "array"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "our_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_terms_days": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "price_includes_vat": {
            "type": "boolean"
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "reverse_charge_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "vat_treatment": {
            "type": [
              "string",
              "null"
            ]
          },
          "your_reference": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "invoice_date",
          "due_date"
        ],
        "type": "object"
      },
      "CustomerInvoiceCreditRequest": {
        "properties": {
          "credit_date": {
            "format": "date",
            "type": "string"
          },
          "dry_run": {
            "type": "boolean"
          },
          "full_credit": {
            "type": "boolean"
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/CustomerInvoiceItemUpdateRequest"
            },
            "type": "array"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          }
        },
        "required": [
          "credit_date"
        ],
        "type": "object"
      },
      "CustomerInvoiceDeliveryResponse": {
        "properties": {
          "channel": {
            "type": "string"
          },
          "company_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "failed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_id": {
            "type": "string"
          },
          "metadata": {},
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "recipient_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "sender_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "company_id",
          "invoice_id",
          "channel",
          "status",
          "metadata",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "CustomerInvoiceIssueRequest": {
        "properties": {
          "channel": {
            "type": [
              "string",
              "null"
            ]
          },
          "dry_run": {
            "type": "boolean"
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "override_lines": {
            "description": "Caller-edited verifikat lines that replace the auto-derived entry.\nEach is `{account, account_name?, debit?, credit?, description?}`;\nvalidated server-side (balanced + equal to the invoice total).",
            "items": {},
            "type": [
              "array",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "CustomerInvoiceItemResponse": {
        "properties": {
          "description": {
            "type": "string"
          },
          "discount_percent": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "line_metadata": {},
          "line_total": {
            "format": "double",
            "type": "number"
          },
          "quantity": {
            "format": "double",
            "type": "number"
          },
          "revenue_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "sort_order": {
            "format": "int32",
            "type": "integer"
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_price": {
            "format": "double",
            "type": "number"
          },
          "vat_amount": {
            "format": "double",
            "type": "number"
          },
          "vat_rate": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "sort_order",
          "description",
          "quantity",
          "unit_price",
          "line_total",
          "vat_amount",
          "line_metadata"
        ],
        "type": "object"
      },
      "CustomerInvoiceItemUpdateRequest": {
        "properties": {
          "description": {
            "type": "string"
          },
          "discount": {
            "format": "double",
            "type": "number"
          },
          "line_metadata": {},
          "quantity": {
            "format": "double",
            "type": "number"
          },
          "revenue_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_price": {
            "format": "double",
            "type": "number"
          },
          "vat_rate": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "description"
        ],
        "type": "object"
      },
      "CustomerInvoiceMutationResponse": {
        "properties": {
          "audit_event_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "delivery": {},
          "entry": {},
          "invoice": {
            "$ref": "#/components/schemas/CustomerInvoiceOutResponse"
          },
          "links": {
            "items": {},
            "type": "array"
          },
          "payment": {},
          "preview": {},
          "verification": {
            "$ref": "#/components/schemas/CustomerInvoiceVerificationBlock"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "invoice",
          "links",
          "warnings",
          "audit_event_ids",
          "verification"
        ],
        "type": "object"
      },
      "CustomerInvoiceOutItem": {
        "properties": {
          "description": {
            "type": "string"
          },
          "discount_percent": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "line_metadata": {},
          "line_total": {
            "type": "string"
          },
          "quantity": {
            "type": "string"
          },
          "revenue_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "sort_order": {
            "format": "int32",
            "type": "integer"
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_price": {
            "type": "string"
          },
          "vat_amount": {
            "type": "string"
          },
          "vat_rate": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "sort_order",
          "description",
          "quantity",
          "unit_price",
          "line_total",
          "vat_amount",
          "line_metadata"
        ],
        "type": "object"
      },
      "CustomerInvoiceOutResponse": {
        "properties": {
          "accounting_method_snapshot": {
            "type": "string"
          },
          "company_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "credited_invoice_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "customer_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_type": {
            "type": "string"
          },
          "due_date": {
            "type": "string"
          },
          "entry_context": {},
          "fortnox_document_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "invoice_date": {
            "type": "string"
          },
          "invoice_number": {
            "type": "string"
          },
          "issue_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "issued_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/CustomerInvoiceOutItem"
            },
            "type": "array"
          },
          "last_settlement_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "our_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "paid_amount": {
            "type": "string"
          },
          "paid_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_terms_days": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "price_includes_vat": {
            "type": "boolean"
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "remaining_amount": {
            "type": "string"
          },
          "reverse_charge_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "subtotal": {
            "type": "string"
          },
          "total": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "vat_amount": {
            "type": "string"
          },
          "vat_treatment": {
            "type": [
              "string",
              "null"
            ]
          },
          "your_reference": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "company_id",
          "invoice_number",
          "status",
          "document_type",
          "accounting_method_snapshot",
          "invoice_date",
          "due_date",
          "price_includes_vat",
          "currency",
          "subtotal",
          "vat_amount",
          "total",
          "paid_amount",
          "remaining_amount",
          "entry_context",
          "created_at",
          "updated_at",
          "items"
        ],
        "type": "object"
      },
      "CustomerInvoiceRecordPaymentRequest": {
        "properties": {
          "amount": {
            "format": "double",
            "type": "number"
          },
          "bank_transaction_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "custom_lines": {
            "items": {},
            "type": [
              "array",
              "null"
            ]
          },
          "dry_run": {
            "type": "boolean"
          },
          "exchange_rate": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "exchange_rate_difference": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_date": {
            "format": "date",
            "type": "string"
          },
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          }
        },
        "required": [
          "payment_date",
          "amount"
        ],
        "type": "object"
      },
      "CustomerInvoiceResponse": {
        "properties": {
          "accounting_method_snapshot": {
            "type": "string"
          },
          "company_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "credited_invoice_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "customer_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "delivery_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_type": {
            "type": "string"
          },
          "due_date": {
            "type": "string"
          },
          "entry_context": {},
          "fortnox_document_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "invoice_date": {
            "type": "string"
          },
          "invoice_number": {
            "type": "string"
          },
          "issue_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "issued_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/CustomerInvoiceItemResponse"
            },
            "type": "array"
          },
          "last_settlement_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "our_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "paid_amount": {
            "format": "double",
            "type": "number"
          },
          "paid_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_terms_days": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "price_includes_vat": {
            "type": "boolean"
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "remaining_amount": {
            "format": "double",
            "type": "number"
          },
          "reverse_charge_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "subtotal": {
            "format": "double",
            "type": "number"
          },
          "total": {
            "format": "double",
            "type": "number"
          },
          "updated_at": {
            "type": "string"
          },
          "vat_amount": {
            "format": "double",
            "type": "number"
          },
          "vat_treatment": {
            "type": [
              "string",
              "null"
            ]
          },
          "your_reference": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "company_id",
          "invoice_number",
          "status",
          "document_type",
          "accounting_method_snapshot",
          "invoice_date",
          "due_date",
          "price_includes_vat",
          "currency",
          "subtotal",
          "vat_amount",
          "total",
          "paid_amount",
          "remaining_amount",
          "entry_context",
          "created_at",
          "updated_at",
          "items"
        ],
        "type": "object"
      },
      "CustomerInvoiceSendRequest": {
        "properties": {
          "channel": {
            "type": "string"
          },
          "dry_run": {
            "type": "boolean"
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "description": "Optional email body override; falls back to the default template.",
            "type": [
              "string",
              "null"
            ]
          },
          "recipient_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          },
          "subject": {
            "description": "Optional email subject override; falls back to a generated subject.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "CustomerInvoiceTimelineEvent": {
        "properties": {
          "data": {
            "description": "Event-type-specific payload. Keys differ per `event_type`; money\nvalues are JSON numbers (FastAPI `Decimal` \u2192 float).",
            "type": "object"
          },
          "document_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "effective_date": {
            "description": "The accounting-effective date (`YYYY-MM-DD`) the timeline sorts on.",
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "invoice_id": {
            "description": "`null` only for a ledger link whose `related_resource_id` is unset.",
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "occurred_at": {
            "description": "`created_at` of the underlying row, ISO `+00:00`.",
            "type": "string"
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "event_type",
          "occurred_at",
          "effective_date",
          "data"
        ],
        "type": "object"
      },
      "CustomerInvoiceUpdateRequest": {
        "properties": {
          "delivery_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "due_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "entry_context_patch": {},
          "items": {
            "items": {
              "$ref": "#/components/schemas/CustomerInvoiceItemUpdateRequest"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "our_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_terms_days": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "price_includes_vat": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "reverse_charge_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_treatment": {
            "type": [
              "string",
              "null"
            ]
          },
          "your_reference": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "CustomerInvoiceVerificationBlock": {
        "properties": {
          "accounting_effect_created": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "created": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "new_paid_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "new_remaining_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "new_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "status_transition": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "DailyUsageResponse": {
        "properties": {
          "calls": {
            "format": "int64",
            "type": "integer"
          },
          "date": {
            "type": "string"
          },
          "total_tokens": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "date",
          "total_tokens",
          "calls"
        ],
        "type": "object"
      },
      "DashboardActivityItemResponse": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "file_type": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "filename",
          "status",
          "file_type",
          "updated_at",
          "created_at"
        ],
        "type": "object"
      },
      "DashboardActivityResponse": {
        "properties": {
          "activity": {
            "items": {
              "$ref": "#/components/schemas/DashboardActivityItemResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "activity"
        ],
        "type": "object"
      },
      "DashboardCounterpartyTotalResponse": {
        "properties": {
          "invoice_count": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "total": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "name",
          "total",
          "invoice_count"
        ],
        "type": "object"
      },
      "DashboardCustomersResponse": {
        "properties": {
          "customers": {
            "items": {
              "$ref": "#/components/schemas/DashboardCounterpartyTotalResponse"
            },
            "type": "array"
          },
          "period": {
            "type": "string"
          },
          "sql_query": {
            "type": "string"
          }
        },
        "required": [
          "customers",
          "period",
          "sql_query"
        ],
        "type": "object"
      },
      "DashboardPipelineResponse": {
        "properties": {
          "document_statuses": {
            "additionalProperties": {
              "format": "int64",
              "type": "integer"
            },
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "journal_entry_approval": {
            "additionalProperties": {
              "format": "int64",
              "type": "integer"
            },
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "total_documents": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "document_statuses",
          "journal_entry_approval",
          "total_documents"
        ],
        "type": "object"
      },
      "DashboardSummaryResponse": {
        "properties": {
          "computed_at": {
            "type": "string"
          },
          "document_count": {
            "format": "int64",
            "type": "integer"
          },
          "expenses": {
            "format": "double",
            "type": "number"
          },
          "fortnox_connected": {
            "type": "boolean"
          },
          "from_date": {
            "type": "string"
          },
          "invoice_count": {
            "format": "int64",
            "type": "integer"
          },
          "monthly_breakdown": {},
          "net_profit": {
            "format": "double",
            "type": "number"
          },
          "period": {
            "type": "string"
          },
          "pipeline": {},
          "revenue": {
            "format": "double",
            "type": "number"
          },
          "source": {
            "type": "string"
          },
          "sql_query": {
            "type": "string"
          },
          "supplier_invoice_count": {
            "format": "int64",
            "type": "integer"
          },
          "to_date": {
            "type": "string"
          }
        },
        "required": [
          "period",
          "from_date",
          "to_date",
          "revenue",
          "expenses",
          "net_profit",
          "invoice_count",
          "supplier_invoice_count",
          "document_count",
          "monthly_breakdown",
          "pipeline",
          "fortnox_connected",
          "sql_query",
          "source",
          "computed_at"
        ],
        "type": "object"
      },
      "DashboardSuppliersResponse": {
        "properties": {
          "period": {
            "type": "string"
          },
          "sql_query": {
            "type": "string"
          },
          "suppliers": {
            "items": {
              "$ref": "#/components/schemas/DashboardCounterpartyTotalResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "suppliers",
          "period",
          "sql_query"
        ],
        "type": "object"
      },
      "DecisionRequest": {
        "description": "Approve / reject request body. The optional note is trimmed and retained in\n`verification.decision.note` on the staged operation.",
        "properties": {
          "note": {
            "description": "Free-text note from the operator.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "DeletableCompanyInfoResponse": {
        "properties": {
          "can_delete": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "member_count": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "member_count",
          "can_delete"
        ],
        "type": "object"
      },
      "DeleteAccountRequest": {
        "properties": {
          "confirmation_code": {
            "type": "string"
          },
          "deletion_challenge": {
            "type": "string"
          }
        },
        "required": [
          "confirmation_code",
          "deletion_challenge"
        ],
        "type": "object"
      },
      "DeleteAccountResponse": {
        "properties": {
          "shared_memberships_removed": {
            "minimum": 0,
            "type": "integer"
          },
          "sole_companies_deleted": {
            "minimum": 0,
            "type": "integer"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "sole_companies_deleted",
          "shared_memberships_removed"
        ],
        "type": "object"
      },
      "DeleteDocumentOut": {
        "properties": {
          "deleted_s3_objects": {
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "deleted_s3_objects"
        ],
        "type": "object"
      },
      "DeleteSavedQueryResponse": {
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "type": "object"
      },
      "DeletionChallengeResponse": {
        "properties": {
          "confirmation_code": {
            "type": "string"
          },
          "deletion_challenge": {
            "type": "string"
          },
          "expires_at": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "confirmation_code",
          "deletion_challenge",
          "expires_at"
        ],
        "type": "object"
      },
      "DeletionInfoResponse": {
        "properties": {
          "companies": {
            "items": {
              "$ref": "#/components/schemas/DeletableCompanyInfoResponse"
            },
            "type": "array"
          },
          "deletable_companies": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "deletion_challenge": {
            "$ref": "#/components/schemas/DeletionChallengeResponse"
          },
          "shared_companies": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "user_email": {
            "type": "string"
          }
        },
        "required": [
          "user_email",
          "companies",
          "deletable_companies",
          "shared_companies",
          "deletion_challenge"
        ],
        "type": "object"
      },
      "DocumentListOut": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/DocumentOut"
            },
            "type": "array"
          },
          "page": {
            "format": "int64",
            "type": "integer"
          },
          "page_size": {
            "format": "int64",
            "type": "integer"
          },
          "total": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "page_size"
        ],
        "type": "object"
      },
      "DocumentOut": {
        "properties": {
          "content_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "document_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "file_category": {
            "type": "string"
          },
          "file_type": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "import_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_filename": {
            "type": "string"
          },
          "process_id": {
            "type": "string"
          },
          "processing_intent": {
            "type": "string"
          },
          "s3_key": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "process_id",
          "s3_key",
          "file_type",
          "file_category",
          "original_filename",
          "status",
          "processing_intent",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "DocumentSearchCorpusItem": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "document_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "extracted_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "import_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_filename": {
            "type": "string"
          },
          "process_id": {
            "type": "string"
          },
          "processing_intent": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "process_id",
          "original_filename",
          "status",
          "processing_intent",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "DocumentSearchCorpusOut": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/DocumentSearchCorpusItem"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "EditSavedQueryRequest": {
        "properties": {
          "instruction": {
            "type": "string"
          }
        },
        "required": [
          "instruction"
        ],
        "type": "object"
      },
      "EmailInboxActivityEntryResponse": {
        "properties": {
          "attachment_count": {
            "format": "int32",
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "is_forwarding_confirmation": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "received_at": {
            "type": "string"
          },
          "sender_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "received_at",
          "status",
          "attachment_count",
          "is_forwarding_confirmation"
        ],
        "type": "object"
      },
      "EmailInboxActivityResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/EmailInboxActivityEntryResponse"
            },
            "type": "array"
          },
          "total": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total"
        ],
        "type": "object"
      },
      "EmailInboxAddAllowlistRequest": {
        "properties": {
          "sender_pattern": {
            "type": "string"
          }
        },
        "required": [
          "sender_pattern"
        ],
        "type": "object"
      },
      "EmailInboxAllowlistEntryResponse": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "sender_pattern": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "sender_pattern",
          "created_at"
        ],
        "type": "object"
      },
      "EmailInboxAllowlistListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/EmailInboxAllowlistEntryResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "EmailInboxDeleteResponse": {
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ],
        "type": "object"
      },
      "EmailInboxSetEnabledRequest": {
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ],
        "type": "object"
      },
      "EmailInboxStateResponse": {
        "properties": {
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "allowlist_count": {
            "format": "int64",
            "type": "integer"
          },
          "domain": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "forwarding_confirmation": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ForwardingConfirmationResponse"
              }
            ]
          },
          "last_received_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "setup_complete": {
            "type": "boolean"
          },
          "test_email_received_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_received": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "domain",
          "enabled",
          "total_received",
          "allowlist_count",
          "setup_complete"
        ],
        "type": "object"
      },
      "EmailInboxTestPingResponse": {
        "properties": {
          "last_test_received_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "received": {
            "type": "boolean"
          }
        },
        "required": [
          "received"
        ],
        "type": "object"
      },
      "EmployeeCreateRequest": {
        "properties": {
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "address1": {
            "type": [
              "string",
              "null"
            ]
          },
          "address2": {
            "type": [
              "string",
              "null"
            ]
          },
          "auto_non_recurring_tax": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "bank_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "card_rule_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "clearing_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "cost_center": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "dated_schedules": {
            "items": {},
            "type": "array"
          },
          "dated_wages": {
            "items": {},
            "type": "array"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "employed_to": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "employee_categories": {
            "items": {},
            "type": "array"
          },
          "employment_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "employment_form": {
            "type": [
              "string",
              "null"
            ]
          },
          "first_name": {
            "type": "string"
          },
          "fortnox_employee_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "full_time_equivalent": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "gross_salary": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "hourly_rate": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "last_name": {
            "type": "string"
          },
          "non_recurring_tax": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "payslip_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "personel_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "personnummer": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone1": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone2": {
            "type": [
              "string",
              "null"
            ]
          },
          "post_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "preliminary_tax_deducted": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "project": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": [
              "string",
              "null"
            ]
          },
          "salary_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "schedule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "setup_status": {
            "type": "string"
          },
          "setup_step": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_allowance": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_column": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_table": {
            "type": [
              "string",
              "null"
            ]
          },
          "vacation_intent": {
            "type": [
              "string",
              "null"
            ]
          },
          "working_time_enumeration": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "first_name",
          "last_name"
        ],
        "type": "object"
      },
      "EmployeeExpenseResponse": {
        "properties": {
          "amount": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "extracted_text": {
            "type": "string"
          },
          "file_type": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "original_filename": {
            "type": [
              "string",
              "null"
            ]
          },
          "s3_key": {
            "type": "string"
          },
          "view_url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "s3_key",
          "file_type",
          "extracted_text",
          "created_at",
          "description",
          "view_url"
        ],
        "type": "object"
      },
      "EmployeeFortnoxPushRequest": {
        "properties": {
          "dated_schedules": {
            "items": {},
            "type": "array"
          },
          "dated_wages": {
            "items": {},
            "type": "array"
          },
          "fortnox_employee": {},
          "fortnox_employee_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "operation": {
            "type": "string"
          },
          "schedule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "vacation_intent": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "EmployeeProfilePicturePresignResponse": {
        "properties": {
          "presigned_url": {
            "type": "string"
          },
          "s3_key": {
            "type": "string"
          }
        },
        "required": [
          "presigned_url",
          "s3_key"
        ],
        "type": "object"
      },
      "EmployeeResponse": {
        "properties": {
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "address1": {
            "type": [
              "string",
              "null"
            ]
          },
          "address2": {
            "type": [
              "string",
              "null"
            ]
          },
          "auto_non_recurring_tax": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "bank_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "card_last_four": {
            "type": [
              "string",
              "null"
            ]
          },
          "card_rule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "clearing_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "cost_center": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "dated_schedules": {
            "items": {},
            "type": "array"
          },
          "dated_wages": {
            "items": {},
            "type": "array"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "employed_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "employee_categories": {
            "items": {},
            "type": "array"
          },
          "employment_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "employment_form": {
            "type": [
              "string",
              "null"
            ]
          },
          "first_name": {
            "type": "string"
          },
          "fortnox_employee_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_last_synced_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_payload": {},
          "fortnox_sync_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_sync_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "full_time_equivalent": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "gross_salary": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "hourly_rate": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "non_recurring_tax": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "payslip_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "personel_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "personnummer": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone1": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone2": {
            "type": [
              "string",
              "null"
            ]
          },
          "post_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "preliminary_tax_deducted": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "profile_picture_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "project": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": [
              "string",
              "null"
            ]
          },
          "salary_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "schedule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "sensitive_fields_redacted": {
            "type": "boolean"
          },
          "setup_status": {
            "type": "string"
          },
          "setup_step": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_allowance": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_column": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_table": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          },
          "vacation_intent": {
            "type": [
              "string",
              "null"
            ]
          },
          "working_time_enumeration": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "first_name",
          "last_name",
          "dated_wages",
          "dated_schedules",
          "employee_categories",
          "setup_status",
          "created_at",
          "updated_at",
          "sensitive_fields_redacted"
        ],
        "type": "object"
      },
      "EmployeeUpdateRequest": {
        "properties": {
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "address1": {
            "type": [
              "string",
              "null"
            ]
          },
          "address2": {
            "type": [
              "string",
              "null"
            ]
          },
          "auto_non_recurring_tax": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "bank_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "card_rule_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "clearing_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "cost_center": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "dated_schedules": {
            "items": {},
            "type": [
              "array",
              "null"
            ]
          },
          "dated_wages": {
            "items": {},
            "type": [
              "array",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "employed_to": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "employee_categories": {
            "items": {},
            "type": [
              "array",
              "null"
            ]
          },
          "employment_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "employment_form": {
            "type": [
              "string",
              "null"
            ]
          },
          "first_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_employee_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "full_time_equivalent": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "gross_salary": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "hourly_rate": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "non_recurring_tax": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "payslip_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "personel_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "personnummer": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone1": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone2": {
            "type": [
              "string",
              "null"
            ]
          },
          "post_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "preliminary_tax_deducted": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "project": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": [
              "string",
              "null"
            ]
          },
          "salary_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "schedule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "setup_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "setup_step": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_allowance": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_column": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_table": {
            "type": [
              "string",
              "null"
            ]
          },
          "vacation_intent": {
            "type": [
              "string",
              "null"
            ]
          },
          "working_time_enumeration": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "EmployeeWageStatusResponse": {
        "properties": {
          "employee_id": {
            "type": "string"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "personel_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "salary_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_column": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_table": {
            "type": [
              "string",
              "null"
            ]
          },
          "vacation_intent": {
            "type": [
              "string",
              "null"
            ]
          },
          "wage_period": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WagePeriodResponse"
              }
            ]
          }
        },
        "required": [
          "employee_id",
          "first_name",
          "last_name"
        ],
        "type": "object"
      },
      "EmployerDeclarationResponse": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "download_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "period_month": {
            "format": "int32",
            "type": "integer"
          },
          "period_year": {
            "format": "int32",
            "type": "integer"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "period_year",
          "period_month",
          "status",
          "created_at"
        ],
        "type": "object"
      },
      "EnableBankingAccountMappingRequest": {
        "description": "Map (or, with a null id, unmap) an Enable Banking account onto an existing bank\naccount so the feed books onto it instead of a duplicate account.",
        "properties": {
          "target_bank_account_id": {
            "description": "Target bank account id to book this feed onto, or null to clear the explicit mapping.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "EnableBankingAccountMappingResponse": {
        "properties": {
          "eb_account_uid": {
            "type": "string"
          },
          "mapped_bank_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "migrated_transaction_count": {
            "format": "int64",
            "type": "integer"
          },
          "skipped_transaction_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "eb_account_uid",
          "migrated_transaction_count",
          "skipped_transaction_count"
        ],
        "type": "object"
      },
      "EnableBankingAccountResponse": {
        "properties": {
          "available_balance": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance_as_of": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_account_id": {
            "type": "string"
          },
          "cash_account_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "current_balance": {
            "type": [
              "string",
              "null"
            ]
          },
          "eb_account_uid": {
            "type": [
              "string",
              "null"
            ]
          },
          "iban": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "last_synced_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "owner_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "synced_through": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "bank_account_id",
          "status"
        ],
        "type": "object"
      },
      "EnableBankingAspspResponse": {
        "properties": {
          "beta": {
            "type": "boolean"
          },
          "bic": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": "string"
          },
          "logo": {
            "type": [
              "string",
              "null"
            ]
          },
          "maximum_consent_validity": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "psu_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "required_psu_headers": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "name",
          "country",
          "psu_types",
          "maximum_consent_validity",
          "beta",
          "required_psu_headers"
        ],
        "type": "object"
      },
      "EnableBankingCallbackRequest": {
        "properties": {
          "code": {
            "type": "string"
          },
          "state": {
            "type": "string"
          }
        },
        "required": [
          "state",
          "code"
        ],
        "type": "object"
      },
      "EnableBankingCallbackResponse": {
        "properties": {
          "accounts": {
            "items": {
              "$ref": "#/components/schemas/EnableBankingAccountResponse"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "workflow_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "status",
          "accounts"
        ],
        "type": "object"
      },
      "EnableBankingConnectionListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/EnableBankingConnectionResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "EnableBankingConnectionResponse": {
        "properties": {
          "accepted_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "accounts": {
            "items": {
              "$ref": "#/components/schemas/EnableBankingAccountResponse"
            },
            "type": "array"
          },
          "aspsp_country": {
            "type": "string"
          },
          "aspsp_logo": {
            "type": [
              "string",
              "null"
            ]
          },
          "aspsp_name": {
            "type": "string"
          },
          "bank_feed_schedule": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/EnableBankingConnectionScheduleResponse"
              }
            ]
          },
          "created_at": {
            "type": "string"
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "link_url": {
            "type": "string"
          },
          "session_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "state",
          "aspsp_name",
          "aspsp_country",
          "status",
          "link_url",
          "created_at",
          "accounts"
        ],
        "type": "object"
      },
      "EnableBankingConnectionScheduleResponse": {
        "properties": {
          "cadence": {
            "type": "string"
          },
          "day_of_week": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "paused": {
            "description": "Convenience flag mirroring `status == \"paused\"` for the UI toggle.",
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "time_of_day": {
            "type": [
              "string",
              "null"
            ]
          },
          "times_per_day": {
            "format": "int32",
            "type": "integer"
          },
          "timezone": {
            "type": "string"
          }
        },
        "required": [
          "cadence",
          "status",
          "timezone",
          "times_per_day",
          "paused"
        ],
        "type": "object"
      },
      "EnableBankingCreateConnectionRequest": {
        "properties": {
          "aspsp_bic": {
            "type": [
              "string",
              "null"
            ]
          },
          "aspsp_country": {
            "type": "string"
          },
          "aspsp_logo": {
            "type": [
              "string",
              "null"
            ]
          },
          "aspsp_name": {
            "type": "string"
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "psu_type": {
            "type": "string"
          },
          "redirect_url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "aspsp_name",
          "aspsp_country"
        ],
        "type": "object"
      },
      "EnableBankingCreateConnectionResponse": {
        "properties": {
          "link_url": {
            "type": "string"
          },
          "run_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "session_pk": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "workflow_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "session_pk",
          "state",
          "link_url",
          "status"
        ],
        "type": "object"
      },
      "EnableBankingScheduleUpdateRequest": {
        "properties": {
          "cadence": {
            "type": "string"
          },
          "day_of_week": {
            "format": "int32",
            "type": "integer"
          },
          "paused": {
            "description": "Suspend the schedule while keeping its cadence configuration.",
            "type": "boolean"
          },
          "time_of_day": {
            "type": "string"
          },
          "times_per_day": {
            "description": "Evenly-spaced syncs per day for the `daily` cadence (1..=4). Defaults to 1.",
            "format": "int32",
            "type": "integer"
          },
          "timezone": {
            "type": "string"
          }
        },
        "required": [
          "timezone",
          "time_of_day"
        ],
        "type": "object"
      },
      "EnableBankingStatusResponse": {
        "properties": {
          "credential_mode": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "environment": {
            "type": [
              "string",
              "null"
            ]
          },
          "platform_connection_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "platform_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "redirect_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "restricted": {
            "type": "boolean"
          },
          "restriction_message": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "enabled",
          "credential_mode",
          "restricted"
        ],
        "type": "object"
      },
      "EnableBankingWorkflowDispatchResponse": {
        "properties": {
          "run_id": {
            "type": "string"
          },
          "workflow_id": {
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "run_id"
        ],
        "type": "object"
      },
      "ExecuteRequest": {
        "description": "Execute-staged-operation request body. Matches the Python\n`StagedOperationExecutionRequest` Pydantic model.",
        "properties": {
          "audit_event_ids": {
            "description": "Caller-provided audit_event_ids to append to the operation's\nlist, used by executors to link the operation back to audit events they\nemitted while running.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "execution_reference_id": {
            "description": "Optional reference id - written straight to\n`execution_reference_id`. Stored as TEXT (Python's column type\nallows arbitrary string ids - not constrained to UUID).",
            "type": [
              "string",
              "null"
            ]
          },
          "execution_reference_type": {
            "description": "Optional reference type (e.g. `\"ledger_entry\"`) - written\nstraight to `execution_reference_type`.",
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "description": "Free-text note - same shape as DecisionRequest.note.",
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "description": "Result payload to record on the operation row."
          }
        },
        "type": "object"
      },
      "FailureRequest": {
        "description": "Fail-staged-operation request body. Matches the Python\n`StagedOperationFailureRequest` Pydantic model.",
        "properties": {
          "audit_event_ids": {
            "description": "Caller-provided audit_event_ids - same as ExecuteRequest.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "error": {
            "description": "Error payload to record on the operation row. Surfaced in the\n`error` field of the response DTO."
          },
          "note": {
            "description": "Free-text note - same as DecisionRequest.note.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "FiscalPeriodCreateRequest": {
        "properties": {
          "period_end": {
            "format": "date",
            "type": "string"
          },
          "period_start": {
            "format": "date",
            "type": "string"
          }
        },
        "required": [
          "period_start",
          "period_end"
        ],
        "type": "object"
      },
      "FiscalPeriodResponse": {
        "properties": {
          "closed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "closed_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "is_closed": {
            "type": "boolean"
          },
          "is_locked": {
            "type": "boolean"
          },
          "opening_balance_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "opening_balances_set": {
            "type": "boolean"
          },
          "period_end": {
            "type": "string"
          },
          "period_start": {
            "type": "string"
          },
          "result_transfer_entry_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "company_id",
          "period_start",
          "period_end",
          "is_locked",
          "is_closed",
          "opening_balances_set"
        ],
        "type": "object"
      },
      "FiscalPeriodUpdateRequest": {
        "properties": {
          "period_end": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "period_start": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "FixedAssetDepreciationPostRequest": {
        "properties": {
          "asset_id": {
            "format": "uuid",
            "type": "string"
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "asset_id",
          "fiscal_period_id"
        ],
        "type": "object"
      },
      "FixedAssetDisposalRequest": {
        "properties": {
          "asset_id": {
            "format": "uuid",
            "type": "string"
          },
          "disposal_date": {
            "format": "date",
            "type": "string"
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": "string"
          },
          "gain_account": {
            "type": "string"
          },
          "loss_account": {
            "type": "string"
          },
          "proceeds": {
            "type": "string"
          },
          "proceeds_account": {
            "type": "string"
          }
        },
        "required": [
          "asset_id",
          "fiscal_period_id",
          "disposal_date",
          "proceeds",
          "proceeds_account",
          "gain_account",
          "loss_account"
        ],
        "type": "object"
      },
      "FixedAssetJamkningPostRequest": {
        "properties": {
          "adjustment_date": {
            "format": "date",
            "type": "string"
          },
          "adjustment_year": {
            "format": "int32",
            "type": "integer"
          },
          "asset_id": {
            "format": "uuid",
            "type": "string"
          },
          "capital_good_type": {
            "type": "string"
          },
          "correction_period_start_year": {
            "format": "int32",
            "type": "integer"
          },
          "counter_account": {
            "type": "string"
          },
          "current_deduction_right_pct": {
            "type": "string"
          },
          "deduction_right_at_start_pct": {
            "type": "string"
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": "string"
          },
          "korrigeringstid_years": {
            "format": "int32",
            "minimum": 0,
            "type": "integer"
          },
          "ursprungsbelopp": {
            "type": "string"
          },
          "vat_settlement_account": {
            "type": "string"
          }
        },
        "required": [
          "asset_id",
          "fiscal_period_id",
          "adjustment_date",
          "ursprungsbelopp",
          "korrigeringstid_years",
          "correction_period_start_year",
          "capital_good_type",
          "deduction_right_at_start_pct",
          "current_deduction_right_pct",
          "adjustment_year",
          "vat_settlement_account",
          "counter_account"
        ],
        "type": "object"
      },
      "FixedAssetJamkningPreviewRequest": {
        "properties": {
          "adjustment_year": {
            "format": "int32",
            "type": "integer"
          },
          "asset_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "counter_account": {
            "type": "string"
          },
          "current_deduction_right_pct": {
            "type": "string"
          },
          "deduction_right_at_start_pct": {
            "type": "string"
          },
          "korrigeringstid_years": {
            "format": "int32",
            "minimum": 0,
            "type": "integer"
          },
          "ursprungsbelopp": {
            "type": "string"
          },
          "vat_settlement_account": {
            "type": "string"
          }
        },
        "required": [
          "ursprungsbelopp",
          "korrigeringstid_years",
          "deduction_right_at_start_pct",
          "current_deduction_right_pct",
          "adjustment_year",
          "vat_settlement_account",
          "counter_account"
        ],
        "type": "object"
      },
      "FixedAssetOveravskrivningPostRequest": {
        "properties": {
          "change_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": "string"
          },
          "reserve_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_method": {
            "description": "`huvudregel_30` | `kompletteringsregel_20` | `restvardesavskrivning`.",
            "type": "string"
          }
        },
        "required": [
          "fiscal_period_id",
          "tax_method"
        ],
        "type": "object"
      },
      "FixedAssetReconcileRequest": {
        "properties": {
          "accumulated_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "acquisition_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "fiscal_period_id"
        ],
        "type": "object"
      },
      "FixedAssetRegisterRequest": {
        "properties": {
          "accounting_basis": {
            "type": "string"
          },
          "accumulated_depreciation_account_number": {
            "type": "string"
          },
          "acquisition_cost": {
            "type": "string"
          },
          "acquisition_date": {
            "format": "date",
            "type": "string"
          },
          "asset_account_number": {
            "type": "string"
          },
          "asset_class": {
            "type": [
              "string",
              "null"
            ]
          },
          "asset_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "depreciation_expense_account_number": {
            "type": "string"
          },
          "depreciation_method": {
            "type": [
              "string",
              "null"
            ]
          },
          "framework": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "placed_in_service_date": {
            "format": "date",
            "type": "string"
          },
          "residual_value": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "source_entry_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "useful_life_months": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "name",
          "acquisition_date",
          "placed_in_service_date",
          "acquisition_cost",
          "accounting_basis",
          "useful_life_months",
          "asset_account_number",
          "accumulated_depreciation_account_number",
          "depreciation_expense_account_number"
        ],
        "type": "object"
      },
      "FixedAssetTaxPreviewRequest": {
        "properties": {
          "asset_id": {
            "format": "uuid",
            "type": "string"
          },
          "method": {
            "description": "`huvudregel_30` | `kompletteringsregel_20` | `restvardesavskrivning`.",
            "type": "string"
          },
          "number_of_years": {
            "format": "int32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "asset_id",
          "method"
        ],
        "type": "object"
      },
      "FortnoxCallbackQuery": {
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "FortnoxConnectQuery": {
        "properties": {
          "include_attachments": {
            "type": "boolean"
          },
          "return_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "scope_override": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "FortnoxConnectResponse": {
        "properties": {
          "authorization_url": {
            "type": "string"
          }
        },
        "required": [
          "authorization_url"
        ],
        "type": "object"
      },
      "FortnoxDebugConfigResponse": {
        "properties": {
          "attachment_scopes": {
            "type": "string"
          },
          "auth_url": {
            "type": "string"
          },
          "client_id_suffix": {
            "type": "string"
          },
          "default_scopes": {
            "type": "string"
          },
          "redirect_uri": {
            "type": "string"
          },
          "token_url": {
            "type": "string"
          }
        },
        "required": [
          "client_id_suffix",
          "redirect_uri",
          "auth_url",
          "token_url",
          "default_scopes",
          "attachment_scopes"
        ],
        "type": "object"
      },
      "FortnoxEmployeeResponse": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "employed_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "employment_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "first_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_employee_id": {
            "type": "string"
          },
          "fortnox_payload": {},
          "full_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "hourly_pay": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "inactive": {
            "type": "boolean"
          },
          "job_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_synced_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "local_employee_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "monthly_salary": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "personal_identity_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone1": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone2": {
            "type": [
              "string",
              "null"
            ]
          },
          "salary_form": {
            "type": [
              "string",
              "null"
            ]
          },
          "schedule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "fortnox_employee_id",
          "inactive",
          "fortnox_payload",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "FortnoxFinancialYearImportResponse": {
        "properties": {
          "completed_at": {
            "type": "string"
          },
          "conflicts": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "periods_created": {
            "format": "int32",
            "type": "integer"
          },
          "periods_replaced": {
            "format": "int32",
            "type": "integer"
          },
          "records_synced": {
            "format": "int32",
            "type": "integer"
          },
          "skipped": {
            "format": "int32",
            "type": "integer"
          },
          "source": {
            "type": "string"
          }
        },
        "required": [
          "source",
          "records_synced",
          "skipped",
          "periods_created",
          "periods_replaced",
          "conflicts",
          "completed_at"
        ],
        "type": "object"
      },
      "FortnoxInboxFilePullResult": {
        "properties": {
          "archive_file_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "content_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "filename": {
            "type": "string"
          },
          "folder": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_file_id": {
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "skipped": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "provider_file_id",
          "filename",
          "status",
          "skipped"
        ],
        "type": "object"
      },
      "FortnoxInboxFileResponse": {
        "properties": {
          "archive_file_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "content_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "filename": {
            "type": "string"
          },
          "folder": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_file_id": {
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "skipped": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "provider_file_id",
          "filename",
          "status",
          "skipped"
        ],
        "type": "object"
      },
      "FortnoxInboxPullRequest": {
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "folders": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "FortnoxInboxPullResponse": {
        "properties": {
          "already_imported_count": {
            "minimum": 0,
            "type": "integer"
          },
          "dry_run": {
            "type": "boolean"
          },
          "duplicate_count": {
            "minimum": 0,
            "type": "integer"
          },
          "failed_count": {
            "minimum": 0,
            "type": "integer"
          },
          "files": {
            "items": {
              "$ref": "#/components/schemas/FortnoxInboxFilePullResult"
            },
            "type": "array"
          },
          "folders": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "imported_count": {
            "minimum": 0,
            "type": "integer"
          },
          "provider": {
            "type": "string"
          },
          "seen_count": {
            "minimum": 0,
            "type": "integer"
          },
          "unsupported_count": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "provider",
          "folders",
          "seen_count",
          "imported_count",
          "already_imported_count",
          "duplicate_count",
          "unsupported_count",
          "failed_count",
          "dry_run",
          "files"
        ],
        "type": "object"
      },
      "FortnoxInboxStatusResponse": {
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "recent_files": {
            "items": {
              "$ref": "#/components/schemas/FortnoxInboxFileResponse"
            },
            "type": "array"
          },
          "sync_status": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/FortnoxInboxSyncStatusResponse"
              }
            ]
          }
        },
        "required": [
          "connected",
          "recent_files"
        ],
        "type": "object"
      },
      "FortnoxInboxSyncStatusResponse": {
        "properties": {
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "details": {},
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "records_synced": {
            "format": "int32",
            "type": "integer"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "sync_type": {
            "type": "string"
          }
        },
        "required": [
          "sync_type",
          "status",
          "records_synced",
          "details"
        ],
        "type": "object"
      },
      "FortnoxStatusResponse": {
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "scopes": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "connected"
        ],
        "type": "object"
      },
      "FortnoxSyncJobRequest": {
        "properties": {
          "resources": {
            "items": {
              "$ref": "#/components/schemas/FortnoxSyncResource"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "FortnoxSyncJobResourceResult": {
        "properties": {
          "collisions": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "marked_missing": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "periods": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "records_synced": {
            "format": "int32",
            "type": "integer"
          },
          "replaced_core": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "resource": {
            "$ref": "#/components/schemas/FortnoxSyncResource"
          },
          "skipped": {
            "format": "int32",
            "type": "integer"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "resource",
          "status",
          "records_synced",
          "skipped"
        ],
        "type": "object"
      },
      "FortnoxSyncJobResponse": {
        "properties": {
          "errors": {
            "additionalProperties": {
              "type": "string"
            },
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/FortnoxSyncJobResourceResult"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "total_records": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "status",
          "total_records",
          "results",
          "errors"
        ],
        "type": "object"
      },
      "FortnoxSyncResource": {
        "enum": [
          "company_info",
          "financial_years",
          "locked_period",
          "accounts",
          "suppliers",
          "customers",
          "projects",
          "cost_centers",
          "employees",
          "vouchers",
          "supplier_invoices",
          "customer_invoices",
          "supplier_invoice_payments",
          "customer_invoice_payments"
        ],
        "type": "string"
      },
      "FortnoxSyncStartRequest": {
        "properties": {
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "FortnoxSyncStartResponse": {
        "properties": {
          "message": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "message"
        ],
        "type": "object"
      },
      "FortnoxSyncStatusResponse": {
        "properties": {
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "records_synced": {
            "format": "int32",
            "type": "integer"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "sync_type": {
            "type": "string"
          }
        },
        "required": [
          "sync_type",
          "status",
          "records_synced"
        ],
        "type": "object"
      },
      "ForwardingConfirmationResponse": {
        "properties": {
          "confirmation_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "confirmation_link": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider": {
            "type": "string"
          },
          "received_at": {
            "type": "string"
          },
          "sender_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "provider",
          "received_at"
        ],
        "type": "object"
      },
      "GlobalSummary": {
        "properties": {
          "from_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "match_row_count": {
            "format": "int64",
            "type": "integer"
          },
          "signed_sum": {
            "type": "string"
          },
          "status_totals": {
            "additionalProperties": {
              "$ref": "#/components/schemas/StatusTotalResponse"
            },
            "description": "Map status \u2192 bucket. `BTreeMap` iteration is sorted, so the\nJSON object's key order is alphabetical.",
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "to_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "transaction_count",
          "signed_sum",
          "status_totals",
          "match_row_count"
        ],
        "type": "object"
      },
      "HealthResponse": {
        "properties": {
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "IdempotencyKey": {
        "properties": {
          "value": {
            "description": "Client-supplied retry identity for a mutating request.",
            "type": "string"
          }
        },
        "required": [
          "value"
        ],
        "type": "object"
      },
      "IdempotencyKeyHeader": {
        "properties": {
          "value": {
            "description": "Client-supplied retry identity for mutating requests. Do not use it as a\nrequest trace ID or user-facing support handle.",
            "type": "string"
          }
        },
        "required": [
          "value"
        ],
        "type": "object"
      },
      "ImportColumnMapping": {
        "properties": {
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance": {
            "type": [
              "string",
              "null"
            ]
          },
          "card_last_four": {
            "type": [
              "string",
              "null"
            ]
          },
          "counterparty": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "deposit_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "iban": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "value_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "withdrawal_amount": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "Ink2PostBody": {
        "properties": {
          "adjustments": {
            "description": "INK2S manual adjustment block (nested `accounting_core::ink2::Ink2sInput`).\nDocumented as a free-form object so the core crate needs no `utoipa::ToSchema`.",
            "type": "object"
          },
          "format": {
            "type": "string"
          },
          "periodId": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "periodId"
        ],
        "type": "object"
      },
      "IntegrationIngestionDetail": {
        "description": "Read-only invoice-ingestion health summary for one provider. Safe metadata only.",
        "properties": {
          "connection_status": {
            "type": "string"
          },
          "dead_letter_count": {
            "format": "int64",
            "type": "integer"
          },
          "default_processing_intent": {
            "type": "string"
          },
          "failed_count": {
            "format": "int64",
            "type": "integer"
          },
          "last_event_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "last_invoice_processed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "last_invoice_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider": {
            "type": "string"
          },
          "reauth_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_processed": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "provider",
          "connection_status",
          "default_processing_intent",
          "total_processed",
          "failed_count",
          "dead_letter_count"
        ],
        "type": "object"
      },
      "IntegrationSyncStatusFull": {
        "description": "`detail=full` response.",
        "properties": {
          "active_run": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ActiveRunStatus"
              }
            ]
          },
          "connected": {
            "type": "boolean"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_vouchers": {
            "items": {},
            "type": "array"
          },
          "pull_status": {
            "$ref": "#/components/schemas/PullStatus"
          },
          "unsupported_reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "connected",
          "pull_status"
        ],
        "type": "object"
      },
      "IntegrationSyncStatusResponse": {
        "description": "One of the two `detail` shapes. `untagged` so each serializes as its\ninner object directly (no discriminant wrapper) \u2014 the frontend keys\noff `active_run` vs `active_run_summary`, not a tag.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/IntegrationSyncStatusFull"
          },
          {
            "$ref": "#/components/schemas/IntegrationSyncStatusSummary"
          }
        ]
      },
      "IntegrationSyncStatusSummary": {
        "description": "`detail=summary` response. The active run is exposed under\n`active_run_summary` and the full voucher list is replaced by a\n`provider_voucher_count`.",
        "properties": {
          "active_run_summary": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ActiveRunStatus"
              }
            ]
          },
          "connected": {
            "type": "boolean"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_voucher_count": {
            "format": "int64",
            "type": "integer"
          },
          "provider_vouchers": {
            "items": {},
            "type": "array"
          },
          "pull_status": {
            "$ref": "#/components/schemas/PullStatus"
          },
          "unsupported_reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "connected",
          "pull_status",
          "provider_voucher_count"
        ],
        "type": "object"
      },
      "IntegrationTenantProfileListResponse": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/IntegrationTenantProfileResponse"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "IntegrationTenantProfileResponse": {
        "properties": {
          "adapter_id": {
            "type": "string"
          },
          "approved_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "effective_from": {
            "type": [
              "string",
              "null"
            ]
          },
          "effective_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "profile_key": {
            "type": "string"
          },
          "provider_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "version": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "provider_id",
          "profile_key",
          "version",
          "status",
          "adapter_id"
        ],
        "type": "object"
      },
      "InviteCompanyMemberRequest": {
        "properties": {
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string"
          }
        },
        "required": [
          "email"
        ],
        "type": "object"
      },
      "LabelResolution": {
        "description": "A resolved account label, recording which language was actually returned and\nwhether the resolver fell back from the requested language.",
        "properties": {
          "account_number": {
            "type": "string"
          },
          "bas_version": {
            "format": "int32",
            "type": "integer"
          },
          "fell_back": {
            "description": "True when the requested language was unavailable and another was returned.",
            "type": "boolean"
          },
          "label": {
            "type": "string"
          },
          "language_returned": {
            "type": "string"
          },
          "reason": {
            "description": "Set when `fell_back` is true, explaining the substitution.",
            "type": [
              "string",
              "null"
            ]
          },
          "requested_language": {
            "type": "string"
          }
        },
        "required": [
          "bas_version",
          "account_number",
          "requested_language",
          "language_returned",
          "label",
          "fell_back"
        ],
        "type": "object"
      },
      "LedgerDateUpdateRequest": {
        "properties": {
          "date": {
            "description": "New voucher date (YYYY-MM-DD). Determines the fiscal period the entry\nbelongs to; both the current and target periods must be open.",
            "format": "date",
            "type": "string"
          }
        },
        "required": [
          "date"
        ],
        "type": "object"
      },
      "LedgerDescriptionUpdateRequest": {
        "properties": {
          "description": {
            "type": "string"
          }
        },
        "required": [
          "description"
        ],
        "type": "object"
      },
      "LedgerDraftUpdateRequest": {
        "properties": {
          "correction_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_metadata": {
            "type": "object"
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/LedgerLineUpdateRequest"
            },
            "type": "array"
          },
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "LedgerEntryChainResponse": {
        "properties": {
          "chain": {
            "items": {
              "$ref": "#/components/schemas/LedgerEntryResponse"
            },
            "type": "array"
          },
          "entry": {
            "$ref": "#/components/schemas/LedgerEntryResponse"
          }
        },
        "required": [
          "entry",
          "chain"
        ],
        "type": "object"
      },
      "LedgerEntryResponse": {
        "properties": {
          "base_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "buyer_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "buyer_org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "committed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": "string"
          },
          "corrected_by_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "correction_of_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "correction_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency_unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "customer_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "customer_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry_context": {},
          "entry_date": {
            "type": "string"
          },
          "entry_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "export_provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "exported_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_archive_file_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_attachment_documents": {},
          "fortnox_attachment_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_attachment_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_attachment_verified_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_file_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "fortnox_voucher_json": {},
          "fortnox_voucher_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "intent": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/LedgerLineResponse"
            },
            "type": "array"
          },
          "llm_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "needs_input": {
            "type": "boolean"
          },
          "original_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "posting_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_links": {
            "items": {
              "$ref": "#/components/schemas/ProviderLinkResponse"
            },
            "type": "array"
          },
          "ready_to_post": {
            "type": "boolean"
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "reversed_by_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "reverses_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "supplier_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_by_user_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "voucher_number": {
            "format": "int32",
            "type": "integer"
          },
          "voucher_series": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "company_id",
          "voucher_number",
          "voucher_series",
          "entry_date",
          "status",
          "needs_input",
          "ready_to_post",
          "entry_context",
          "provider_links",
          "fortnox_attachment_documents",
          "lines"
        ],
        "type": "object"
      },
      "LedgerEntrySummaryResponse": {
        "description": "CLI-flavoured ledger-entry summary. Subset of Python\n`_entry_summary` \u2014 only the fields the CLI renderer parses (see\n`output.rs:269-318`). Deferred fields (debit, credit, difference,\nis_balanced, ready_to_post, needs_input, blocker_count, short_id)\nremain available via the legacy in-process path; slice notes\ntrack the deferral.",
        "properties": {
          "description": {
            "type": "string"
          },
          "entry_date": {
            "type": "string"
          },
          "entry_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "matching_line": {
            "$ref": "#/components/schemas/MatchingLineResponse"
          },
          "status": {
            "type": "string"
          },
          "voucher": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "entry_date",
          "status",
          "description",
          "matching_line"
        ],
        "type": "object"
      },
      "LedgerExportPullStatusResponse": {
        "properties": {
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "details": {},
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "records_synced": {
            "format": "int32",
            "type": "integer"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "sync_type": {
            "type": "string"
          }
        },
        "required": [
          "sync_type",
          "status",
          "records_synced",
          "details"
        ],
        "type": "object"
      },
      "LedgerLineResponse": {
        "properties": {
          "account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_number": {
            "type": "string"
          },
          "accrual_end": {
            "type": [
              "string",
              "null"
            ]
          },
          "accrual_start": {
            "type": [
              "string",
              "null"
            ]
          },
          "bas_version": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "book_currency": {
            "type": "string"
          },
          "cost_center": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency_unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "debit": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "employee_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_basis": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "line_type": {
            "type": "string"
          },
          "original_credit": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_debit": {
            "type": [
              "string",
              "null"
            ]
          },
          "period_count": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "period_index": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "posting_rule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "project": {
            "type": [
              "string",
              "null"
            ]
          },
          "provenance": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": [
              "string",
              "null"
            ]
          },
          "rate_evidence": {},
          "rule_pack_code_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "rule_pack_version": {
            "type": [
              "string",
              "null"
            ]
          },
          "sort_order": {
            "format": "int32",
            "type": "integer"
          },
          "transaction_credit_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_debit_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_info": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_price": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_rate": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "account_number",
          "book_currency",
          "rate_evidence",
          "sort_order",
          "line_type"
        ],
        "type": "object"
      },
      "LedgerLineUpdateRequest": {
        "properties": {
          "account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_number": {
            "type": "string"
          },
          "cost_center": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit": {
            "type": "string"
          },
          "debit": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "employee_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "line_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_credit": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_debit": {
            "type": [
              "string",
              "null"
            ]
          },
          "project": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_info": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_code": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "account_number"
        ],
        "type": "object"
      },
      "LedgerLinkRepairStageRequest": {
        "properties": {
          "amount": {
            "type": "string"
          },
          "bank_account_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "bank_from": {
            "format": "date",
            "type": "string"
          },
          "bank_query": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_to": {
            "format": "date",
            "type": "string"
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_from": {
            "format": "date",
            "type": "string"
          },
          "ledger_query": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_status": {
            "type": "string"
          },
          "ledger_to": {
            "format": "date",
            "type": "string"
          },
          "max_days": {
            "format": "int32",
            "type": "integer"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "tolerance": {
            "type": "string"
          }
        },
        "required": [
          "bank_from",
          "bank_to",
          "ledger_from",
          "ledger_to",
          "amount"
        ],
        "type": "object"
      },
      "LinkedEntryResponse": {
        "properties": {
          "actual_cash_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "cash_leg_accounts": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "cash_leg_warning": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry_date": {
            "type": "string"
          },
          "entry_id": {
            "type": "string"
          },
          "expected_cash_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "link_sources": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "short_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "voucher": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "entry_id",
          "short_id",
          "entry_date",
          "status",
          "link_sources",
          "cash_leg_warning",
          "cash_leg_accounts"
        ],
        "type": "object"
      },
      "ListEntriesBody": {
        "description": "Request body for `POST /accounting-entries/query` \u2014 the body-based sibling of\n`GET /accounting-entries`. Filters, service call, and response are identical\nto the GET list; the only difference is that `source_document_ids` travels in\nthe JSON body instead of as repeated query params. This is what lets the\ninbox filter by an arbitrarily large document set: a GET appends one\n`source_document_ids=<uuid>` per document, so a few hundred documents push the\nURL past the ~8 KB proxy limit and the edge returns `414 Request-URI Too\nLarge` (empirically at ~145 ids), which silently blanks the whole inbox/files\nview. A body has no such limit.",
        "properties": {
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "from_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "intent": {
            "type": [
              "string",
              "null"
            ]
          },
          "limit": {
            "format": "int64",
            "type": "integer"
          },
          "ready_to_post": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "search": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "to_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ListMeta": {
        "properties": {
          "count": {
            "minimum": 0,
            "type": "integer"
          },
          "limit": {
            "format": "int64",
            "type": "integer"
          },
          "operation": {
            "description": "Mirrors the Python meta key: stored as `operation_key`, exposed\nas `operation`.",
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "count",
          "limit"
        ],
        "type": "object"
      },
      "ManualMatchRequest": {
        "properties": {
          "bank_transaction_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "document_id": {
            "type": "string"
          }
        },
        "required": [
          "document_id",
          "bank_transaction_ids"
        ],
        "type": "object"
      },
      "ManualMatchResponse": {
        "properties": {
          "created": {
            "minimum": 0,
            "type": "integer"
          },
          "match_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "created",
          "match_ids"
        ],
        "type": "object"
      },
      "ManualProviderStatusResponse": {
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "scopes": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "connected"
        ],
        "type": "object"
      },
      "MarkAllReadResponse": {
        "properties": {
          "marked_read": {
            "format": "int64",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "marked_read"
        ],
        "type": "object"
      },
      "MatchChecksResponse": {
        "properties": {
          "amount_delta": {
            "type": "string"
          },
          "date_delta_days": {
            "format": "int32",
            "type": "integer"
          },
          "existing_bank_transaction_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "ledger_account_number": {
            "type": "string"
          },
          "ledger_already_linked": {
            "type": "boolean"
          }
        },
        "required": [
          "amount_delta",
          "date_delta_days",
          "ledger_account_number",
          "ledger_already_linked",
          "existing_bank_transaction_ids"
        ],
        "type": "object"
      },
      "MatchDecisionRequest": {
        "properties": {
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "MatchingLineResponse": {
        "properties": {
          "account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_number": {
            "type": "string"
          },
          "credit": {
            "type": "string"
          },
          "debit": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "matched_bank_line_amount": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "account_number",
          "debit",
          "credit",
          "matched_bank_line_amount"
        ],
        "type": "object"
      },
      "McpKeyOut": {
        "properties": {
          "api_key": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "api_key",
          "note"
        ],
        "type": "object"
      },
      "McpKeyStatusOut": {
        "properties": {
          "has_key": {
            "type": "boolean"
          }
        },
        "required": [
          "has_key"
        ],
        "type": "object"
      },
      "ModeWire": {
        "enum": [
          "one_to_one",
          "bulk",
          "grouped"
        ],
        "type": "string"
      },
      "MyInvitationsOut": {
        "properties": {
          "invitations": {
            "items": {
              "$ref": "#/components/schemas/PendingInvitationOut"
            },
            "type": "array"
          }
        },
        "required": [
          "invitations"
        ],
        "type": "object"
      },
      "NaturalLanguageParseRequest": {
        "properties": {
          "text": {
            "type": "string"
          }
        },
        "required": [
          "text"
        ],
        "type": "object"
      },
      "NaturalLanguageParseResponse": {
        "properties": {
          "client_company_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "client_name_matched": {
            "type": [
              "string",
              "null"
            ]
          },
          "date": {
            "format": "date",
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "duration_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "start_time": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "description",
          "duration_seconds",
          "date"
        ],
        "type": "object"
      },
      "NextInvoiceNumberResponse": {
        "description": "Preview of the next issue-time identifiers: what invoice number the next\nissued invoice will get and the OCR reference derived from it. Read-only \u2014\nnothing is allocated; a concurrent issue can still claim the number first,\nin which case issue-time values win.",
        "properties": {
          "invoice_number": {
            "type": "string"
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "invoice_number"
        ],
        "type": "object"
      },
      "NotificationOut": {
        "properties": {
          "action_required": {
            "type": "boolean"
          },
          "body": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "download_object_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "due_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "is_read": {
            "type": "boolean"
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "notif_group": {
            "type": [
              "string",
              "null"
            ]
          },
          "params": {
            "type": [
              "object",
              "null"
            ]
          },
          "resolved_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "severity": {
            "type": "string"
          },
          "snoozed_until": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "source_workflow_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "template_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "category",
          "severity",
          "title",
          "is_read",
          "action_required",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "NotificationsResponse": {
        "properties": {
          "notifications": {
            "items": {
              "$ref": "#/components/schemas/NotificationOut"
            },
            "type": "array"
          },
          "total_count": {
            "format": "int64",
            "type": "integer"
          },
          "unread_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "notifications",
          "unread_count",
          "total_count"
        ],
        "type": "object"
      },
      "OauthProviderStatusResponse": {
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "scopes": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "connected"
        ],
        "type": "object"
      },
      "OnboardingTourChapterProgress": {
        "additionalProperties": false,
        "description": "Per-chapter progress. `completed_at` is an ISO-8601 timestamp or null.",
        "properties": {
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "OnboardingTourProgress": {
        "additionalProperties": false,
        "description": "Full guided-tour progress for one user.",
        "properties": {
          "chapters": {
            "additionalProperties": {
              "$ref": "#/components/schemas/OnboardingTourChapterProgress"
            },
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "completed_full_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "skipped_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "OnboardingTourUpdateRequest": {
        "additionalProperties": false,
        "description": "Request body for `PATCH /profile/onboarding-tour`: either `reset: true`\n(restore defaults) or a full `onboarding_tour` progress object.",
        "properties": {
          "onboarding_tour": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/OnboardingTourProgress"
              }
            ]
          },
          "reset": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "Option_String": {
        "oneOf": [
          {
            "type": "null"
          },
          {
            "type": "string"
          }
        ]
      },
      "Option_Vec_AccountingEntryLineInput": {
        "oneOf": [
          {
            "type": "null"
          },
          {
            "items": {
              "properties": {
                "account_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "accrual_end": {
                  "format": "date",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "accrual_start": {
                  "format": "date",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "book_currency": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "cost_center": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "credit": {
                  "type": "string"
                },
                "currency_unit": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "debit": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "employee_id": {
                  "format": "uuid",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "exchange_rate": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "exchange_rate_basis": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "exchange_rate_date": {
                  "format": "date",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "exchange_rate_source": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "line_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "original_credit": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "original_debit": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "period_count": {
                  "format": "int32",
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "period_index": {
                  "format": "int32",
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "posting_rule_id": {
                  "format": "uuid",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "project": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "provenance": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quantity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "rate_evidence": {
                  "type": "object"
                },
                "transaction_credit_amount": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "transaction_currency": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "transaction_debit_amount": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "transaction_info": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "unit_price": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "vat_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "vat_rate": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "type": "object"
            },
            "type": "array"
          }
        ]
      },
      "Option_Vec_String": {
        "oneOf": [
          {
            "type": "null"
          },
          {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        ]
      },
      "PaginationParams": {
        "properties": {
          "ending_before": {
            "description": "Return objects before this cursor.",
            "type": [
              "string",
              "null"
            ]
          },
          "limit": {
            "description": "Maximum number of objects to return.",
            "example": 25,
            "format": "int32",
            "maximum": 100,
            "minimum": 1,
            "type": "integer"
          },
          "starting_after": {
            "description": "Return objects after this cursor.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "limit"
        ],
        "type": "object"
      },
      "PairWire": {
        "properties": {
          "bank_transaction_id": {
            "format": "uuid",
            "type": "string"
          },
          "supplier_invoice_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "bank_transaction_id",
          "supplier_invoice_id"
        ],
        "type": "object"
      },
      "PatchBankAccountRequest": {
        "properties": {
          "account_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "bankgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "bban": {
            "type": [
              "string",
              "null"
            ]
          },
          "bic": {
            "type": [
              "string",
              "null"
            ]
          },
          "cash_account_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "clearing_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "holder_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "iban": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "product": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_account_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_provider": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "PatchSavedQueryRequest": {
        "properties": {
          "chart_config": {},
          "column_config": {
            "items": {},
            "type": [
              "array",
              "null"
            ]
          },
          "sql_query": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "PaymentEntrySummaryResponse": {
        "properties": {
          "blocker_count": {
            "minimum": 0,
            "type": "integer"
          },
          "credit": {
            "type": "string"
          },
          "debit": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "difference": {
            "type": "string"
          },
          "entry_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "is_balanced": {
            "type": "boolean"
          },
          "needs_input": {
            "type": "boolean"
          },
          "ready_to_post": {
            "type": "boolean"
          },
          "short_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "voucher": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "short_id",
          "status",
          "description",
          "debit",
          "credit",
          "difference",
          "is_balanced",
          "ready_to_post",
          "needs_input",
          "blocker_count"
        ],
        "type": "object"
      },
      "PayrollDiagnosticResponse": {
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "path": {
            "type": [
              "string",
              "null"
            ]
          },
          "severity": {
            "type": "string"
          }
        },
        "required": [
          "severity",
          "code",
          "message"
        ],
        "type": "object"
      },
      "PayrollEmployeePreflightRequest": {
        "properties": {
          "dated_schedules": {
            "items": {},
            "type": "array"
          },
          "dated_wages": {
            "items": {},
            "type": "array"
          },
          "first_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "gross_salary": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "hourly_rate": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "personnummer": {
            "type": [
              "string",
              "null"
            ]
          },
          "salary_form": {
            "type": [
              "string",
              "null"
            ]
          },
          "salary_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "schedule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "vacation_intent": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "PayrollEmployeePreflightResponse": {
        "properties": {
          "blockers": {
            "items": {
              "$ref": "#/components/schemas/PayrollDiagnosticResponse"
            },
            "type": "array"
          },
          "fortnox_employee": {},
          "is_ready": {
            "type": "boolean"
          },
          "normalized_personnummer": {
            "type": [
              "string",
              "null"
            ]
          },
          "salary_preview": {},
          "warnings": {
            "items": {
              "$ref": "#/components/schemas/PayrollDiagnosticResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "is_ready",
          "fortnox_employee",
          "blockers",
          "warnings"
        ],
        "type": "object"
      },
      "PayrollPostingPreviewResponse": {
        "properties": {
          "balanced": {
            "type": "boolean"
          },
          "entry_request": {
            "type": "object"
          },
          "line_count": {
            "minimum": 0,
            "type": "integer"
          },
          "period_month": {
            "format": "int32",
            "type": "integer"
          },
          "period_year": {
            "format": "int32",
            "type": "integer"
          },
          "posting_intent": {
            "type": "object"
          },
          "recipient_count": {
            "minimum": 0,
            "type": "integer"
          },
          "total_credit": {
            "format": "double",
            "type": "number"
          },
          "total_debit": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "period_year",
          "period_month",
          "recipient_count",
          "line_count",
          "total_debit",
          "total_credit",
          "balanced",
          "posting_intent",
          "entry_request"
        ],
        "type": "object"
      },
      "PayslipDownloadResponse": {
        "properties": {
          "download_url": {
            "type": "string"
          }
        },
        "required": [
          "download_url"
        ],
        "type": "object"
      },
      "PayslipEmailPreviewResponse": {
        "properties": {
          "note": {
            "type": "string"
          },
          "recipients": {
            "items": {
              "$ref": "#/components/schemas/PayslipEmailRecipientResponse"
            },
            "type": "array"
          },
          "recipients_with_email": {
            "minimum": 0,
            "type": "integer"
          },
          "sender_configured": {
            "type": "boolean"
          },
          "sender_email": {
            "type": "string"
          },
          "total_recipients": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "sender_email",
          "sender_configured",
          "recipients",
          "total_recipients",
          "recipients_with_email",
          "note"
        ],
        "type": "object"
      },
      "PayslipEmailRecipientResponse": {
        "properties": {
          "already_sent": {
            "type": "boolean"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "employee_id": {
            "type": "string"
          },
          "has_email": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "employee_id",
          "name",
          "has_email",
          "status",
          "already_sent"
        ],
        "type": "object"
      },
      "PayslipGenerationResponse": {
        "properties": {
          "email_sent": {
            "type": "boolean"
          },
          "recipient_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "s3_key": {
            "type": "string"
          },
          "sender_email": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "s3_key",
          "email_sent",
          "sender_email"
        ],
        "type": "object"
      },
      "PendingInvitationOut": {
        "properties": {
          "company_id": {
            "type": "string"
          },
          "company_name": {
            "type": "string"
          },
          "expires_at": {
            "type": "string"
          },
          "invitation_id": {
            "type": "string"
          },
          "role": {
            "type": "string"
          }
        },
        "required": [
          "invitation_id",
          "company_id",
          "company_name",
          "role",
          "expires_at"
        ],
        "type": "object"
      },
      "PipelineCancelResponse": {
        "properties": {
          "cancelled": {
            "description": "Whether a running Temporal workflow was found and cancelled. `false` when\nthe document was only reset out of a stuck in-flight state (no live run).",
            "type": "boolean"
          },
          "document_id": {
            "type": "string"
          },
          "status": {
            "description": "The document's resulting status after the stop (`uploaded`).",
            "type": "string"
          }
        },
        "required": [
          "document_id",
          "cancelled",
          "status"
        ],
        "type": "object"
      },
      "PipelineGraphDefinitionResponse": {
        "properties": {
          "edges": {
            "items": {
              "$ref": "#/components/schemas/PipelineGraphEdgeResponse"
            },
            "type": "array"
          },
          "nodes": {
            "items": {
              "$ref": "#/components/schemas/PipelineGraphNodeResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "nodes",
          "edges"
        ],
        "type": "object"
      },
      "PipelineGraphEdgeResponse": {
        "properties": {
          "condition": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string"
          },
          "target": {
            "type": "string"
          }
        },
        "required": [
          "source",
          "target"
        ],
        "type": "object"
      },
      "PipelineGraphNodeResponse": {
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "stage": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "label",
          "type",
          "stage"
        ],
        "type": "object"
      },
      "PipelineRerunRequest": {
        "properties": {
          "processing_intent": {
            "type": [
              "string",
              "null"
            ]
          },
          "stages": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "PipelineRerunResponse": {
        "properties": {
          "process_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "process_id",
          "status"
        ],
        "type": "object"
      },
      "PipelineRunAllRequest": {
        "properties": {
          "stages": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "PipelineRunAllResponse": {
        "properties": {
          "process_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "queued": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "queued",
          "process_ids"
        ],
        "type": "object"
      },
      "PipelineRunResponse": {
        "properties": {
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "graph_name": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "node_history": {
            "items": {},
            "type": "array"
          },
          "process_id": {
            "type": "string"
          },
          "queries_log": {
            "items": {},
            "type": "array"
          },
          "stages": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "started_at": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "total_input_tokens": {
            "format": "int32",
            "type": "integer"
          },
          "total_output_tokens": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "process_id",
          "graph_name",
          "stages",
          "status",
          "node_history",
          "queries_log",
          "total_input_tokens",
          "total_output_tokens",
          "started_at"
        ],
        "type": "object"
      },
      "PlatformFeedBalance": {
        "description": "The platform balance in one currency: totals over every captured transaction,\nplus the available-funds variant.",
        "properties": {
          "as_of": {
            "format": "date-time",
            "type": "string"
          },
          "available_balance": {
            "type": "string"
          },
          "balance": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          }
        },
        "required": [
          "currency",
          "balance",
          "available_balance",
          "as_of"
        ],
        "type": "object"
      },
      "PlatformFeedBalanceResponse": {
        "description": "Per-currency platform balances for one connection.",
        "properties": {
          "balances": {
            "items": {
              "$ref": "#/components/schemas/PlatformFeedBalance"
            },
            "type": "array"
          },
          "connection_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "connection_id",
          "balances"
        ],
        "type": "object"
      },
      "PlatformFeedGroupStagedOperation": {
        "properties": {
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status"
        ],
        "type": "object"
      },
      "PlatformFeedProposalApplyResponse": {
        "description": "Response for booking a reviewed platform-feed ledger proposal.",
        "properties": {
          "ledger_entry_ids": {
            "description": "Draft ledger entries created by this apply (recorded ids on replay).",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "operation": {
            "$ref": "#/components/schemas/StagedOperationResponse"
          },
          "replayed": {
            "type": "boolean"
          }
        },
        "required": [
          "operation",
          "ledger_entry_ids",
          "replayed"
        ],
        "type": "object"
      },
      "PlatformFeedRuleGroup": {
        "description": "One observed provider transaction group that can become an accounting setup\naction item. Raw provider payloads and customer-identifying facts are never\nreturned here.",
        "properties": {
          "actionable_fee_amount": {
            "type": "string"
          },
          "actionable_gross_amount": {
            "description": "Amounts still eligible for the next proposal wave. The unsuffixed\namounts above cover the same all-imported scope as `transaction_count`.",
            "type": "string"
          },
          "actionable_net_amount": {
            "type": "string"
          },
          "actionable_transaction_count": {
            "description": "Rows the next staging wave would claim.",
            "format": "int64",
            "type": "integer"
          },
          "category": {
            "type": "string"
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "evidence": {},
          "fee_amount": {
            "type": "string"
          },
          "first_occurred_at": {
            "format": "date-time",
            "type": "string"
          },
          "gross_amount": {
            "type": "string"
          },
          "group_key": {
            "type": "string"
          },
          "last_occurred_at": {
            "format": "date-time",
            "type": "string"
          },
          "live_staged_operations": {
            "description": "Live proposal waves claiming rows in this group, newest first.",
            "items": {
              "$ref": "#/components/schemas/PlatformFeedGroupStagedOperation"
            },
            "type": "array"
          },
          "missing_data_count": {
            "format": "int64",
            "type": "integer"
          },
          "missing_facts": {
            "description": "Distinct evidence facts still required across the group's rows (frozen\ningest verdicts UNION live catalog evaluation, with the country/tax_rate\ncolumn fallbacks), sorted and deduped, so the UI can name exactly what is\nmissing instead of showing a bare \"Missing data\" badge. Empty (never\nnull) when the group is evidence-complete.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "net_amount": {
            "type": "string"
          },
          "operator_vat_resolved": {
            "description": "True when this group currently uses separately stored operator VAT evidence.",
            "type": "boolean"
          },
          "provider_event_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "provider_id": {
            "type": "string"
          },
          "requires_rule": {
            "description": "Whether the catalog requires a posting rule for this category. This is\nindependent of `status`, which can be `ready` for categories that never\nneed a rule.",
            "type": "boolean"
          },
          "sample_external_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "tax_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_count": {
            "format": "int64",
            "type": "integer"
          },
          "unposted_count": {
            "format": "int64",
            "type": "integer"
          },
          "vat_resolved_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "group_key",
          "provider_id",
          "category",
          "currency",
          "gross_amount",
          "fee_amount",
          "net_amount",
          "actionable_gross_amount",
          "actionable_fee_amount",
          "actionable_net_amount",
          "transaction_count",
          "unposted_count",
          "actionable_transaction_count",
          "live_staged_operations",
          "missing_data_count",
          "missing_facts",
          "requires_rule",
          "status",
          "operator_vat_resolved",
          "provider_event_types",
          "sample_external_ids",
          "first_occurred_at",
          "last_occurred_at",
          "evidence"
        ],
        "type": "object"
      },
      "PlatformFeedRuleGroupsResponse": {
        "description": "Provider-observed transaction groups for one platform-feed connection.",
        "properties": {
          "connection_id": {
            "format": "uuid",
            "type": "string"
          },
          "groups": {
            "items": {
              "$ref": "#/components/schemas/PlatformFeedRuleGroup"
            },
            "type": "array"
          }
        },
        "required": [
          "connection_id",
          "groups"
        ],
        "type": "object"
      },
      "PlatformFeedRun": {
        "description": "One platform-feed sync run, newest first.",
        "properties": {
          "completed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "imported": {
            "description": "Transactions first seen in this run.",
            "format": "int32",
            "type": "integer"
          },
          "provider_id": {
            "type": "string"
          },
          "refreshed": {
            "description": "Existing provider references safely refreshed, not duplicated.",
            "format": "int32",
            "type": "integer"
          },
          "skipped": {
            "description": "Existing references skipped to protect staged or rolled-up accounting facts.",
            "format": "int32",
            "type": "integer"
          },
          "started_at": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "trigger": {
            "type": "string"
          },
          "window_end": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "window_start": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "provider_id",
          "status",
          "trigger",
          "imported",
          "refreshed",
          "skipped",
          "started_at"
        ],
        "type": "object"
      },
      "PlatformFeedRunsResponse": {
        "description": "Run history + schedule for one platform-feed connection.",
        "properties": {
          "connection_id": {
            "format": "uuid",
            "type": "string"
          },
          "runs": {
            "items": {
              "$ref": "#/components/schemas/PlatformFeedRun"
            },
            "type": "array"
          },
          "schedule": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PlatformFeedSchedule"
              }
            ]
          }
        },
        "required": [
          "connection_id",
          "runs"
        ],
        "type": "object"
      },
      "PlatformFeedSchedule": {
        "description": "The connection's sync schedule, when one exists.",
        "properties": {
          "cadence": {
            "type": "string"
          },
          "day_of_week": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "last_sync_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_synced_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "paused": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "time_of_day": {
            "type": [
              "string",
              "null"
            ]
          },
          "times_per_day": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "timezone": {
            "type": "string"
          }
        },
        "required": [
          "cadence",
          "status",
          "timezone",
          "paused"
        ],
        "type": "object"
      },
      "PlatformFeedTransaction": {
        "description": "Safe normalized provider facts for transaction inspection. Raw payloads,\nfree-text descriptions, and customer-identifying facts are intentionally\nexcluded from this public read model.",
        "properties": {
          "accounting_state": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_id": {
            "type": "string"
          },
          "facts": {
            "description": "Curated accounting facts (tax lines, order/invoice/subscription refs).\nCustomer identity and raw payloads stay excluded.",
            "type": "object"
          },
          "fee_amount": {
            "type": "string"
          },
          "fee_details": {
            "description": "Provider fee breakdown as `[{amount, currency, type, description}]`.",
            "type": "object"
          },
          "gross_amount": {
            "type": "string"
          },
          "group_key": {
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "net_amount": {
            "type": "string"
          },
          "occurred_at": {
            "format": "date-time",
            "type": "string"
          },
          "payout_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "presentment_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "presentment_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_event_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_status": {
            "type": "string"
          },
          "source_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_amount": {
            "description": "Operator-resolved VAT amount when present, else the provider-observed\namount from canonical facts.",
            "type": [
              "string",
              "null"
            ]
          },
          "tax_rate": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "group_key",
          "external_id",
          "category",
          "provider_status",
          "accounting_state",
          "currency",
          "gross_amount",
          "fee_amount",
          "net_amount",
          "fee_details",
          "facts",
          "occurred_at"
        ],
        "type": "object"
      },
      "PlatformFeedTransactionDay": {
        "description": "One UTC day band over the full selected connection/group scope.",
        "properties": {
          "currency": {
            "type": "string"
          },
          "day": {
            "format": "date",
            "type": "string"
          },
          "draft_created_count": {
            "format": "int64",
            "type": "integer"
          },
          "fee_amount": {
            "type": "string"
          },
          "gross_amount": {
            "type": "string"
          },
          "imported_count": {
            "format": "int64",
            "type": "integer"
          },
          "matched_to_bank_count": {
            "format": "int64",
            "type": "integer"
          },
          "net_amount": {
            "type": "string"
          },
          "staged_count": {
            "format": "int64",
            "type": "integer"
          },
          "transaction_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "day",
          "currency",
          "transaction_count",
          "gross_amount",
          "fee_amount",
          "net_amount",
          "imported_count",
          "staged_count",
          "draft_created_count",
          "matched_to_bank_count"
        ],
        "type": "object"
      },
      "PlatformFeedTransactionsResponse": {
        "description": "Paginated transaction evidence plus complete day bands for the selected\nscope. Day bands are not page-relative, so their totals remain truthful.",
        "properties": {
          "connection_id": {
            "format": "uuid",
            "type": "string"
          },
          "days": {
            "items": {
              "$ref": "#/components/schemas/PlatformFeedTransactionDay"
            },
            "type": "array"
          },
          "group_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "page": {
            "format": "int64",
            "type": "integer"
          },
          "page_size": {
            "format": "int64",
            "type": "integer"
          },
          "selected_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "selected_day": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "format": "int64",
            "type": "integer"
          },
          "total_pages": {
            "format": "int64",
            "type": "integer"
          },
          "transactions": {
            "items": {
              "$ref": "#/components/schemas/PlatformFeedTransaction"
            },
            "type": "array"
          }
        },
        "required": [
          "connection_id",
          "transactions",
          "days",
          "total",
          "page",
          "page_size",
          "total_pages"
        ],
        "type": "object"
      },
      "PlatformFeedVatTreatment": {
        "description": "Closed set of Swedish VAT treatments an operator may apply to an imported\nsale/refund group whose provider evidence is incomplete.",
        "enum": [
          "standard25",
          "reduced12",
          "reduced6",
          "exempt"
        ],
        "type": "string"
      },
      "PrepareReportRunRequest": {
        "properties": {
          "fiscal_period_id": {
            "description": "Required for ink2 / ink3 / ink4 / ne_bilaga.",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "gavor_bidrag": {
            "description": "INK3-only gifts and grants (8652), not account-range derived. Defaults to zero.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "medlemsavgifter": {
            "description": "INK3-only f\u00f6rening revenue the BAS source marks \"(1)\" \u2014 membership fees\n(8650), not account-range derived. Defaults to zero when omitted so a\nf\u00f6rening's declared revenue is retained on the durable run instead of\nfiling zeros.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "period_end": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "period_start": {
            "description": "Required for vat_momsdeklaration.",
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "report_type": {
            "description": "One of: vat_momsdeklaration, ink2, ink3, ink4, ne_bilaga.",
            "type": "string"
          },
          "serviceavgifter": {
            "description": "INK3-only service fees (8651), not account-range derived. Defaults to zero.",
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "report_type"
        ],
        "type": "object"
      },
      "PresignedUrlOut": {
        "properties": {
          "expires_in": {
            "format": "int64",
            "type": "integer"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "expires_in"
        ],
        "type": "object"
      },
      "PreviewEntityListResponse": {
        "properties": {
          "entities": {
            "items": {
              "$ref": "#/components/schemas/PreviewEntityOut"
            },
            "type": "array"
          },
          "meta": {
            "$ref": "#/components/schemas/PreviewEntityMeta"
          }
        },
        "required": [
          "entities",
          "meta"
        ],
        "type": "object"
      },
      "PreviewEntityMeta": {
        "properties": {
          "active_statuses": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "count": {
            "minimum": 0,
            "type": "integer"
          },
          "limit": {
            "format": "int64",
            "type": "integer"
          },
          "table_key": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "count",
          "limit",
          "active_statuses"
        ],
        "type": "object"
      },
      "PreviewEntityOut": {
        "properties": {
          "automation_run_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "detail_payload": {},
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "entity_type": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "preview_action": {
            "type": "string"
          },
          "row_payload": {},
          "sort_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "staged_operation_id": {
            "type": "string"
          },
          "staged_operation_status": {
            "type": "string"
          },
          "table_key": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "staged_operation_id",
          "table_key",
          "entity_type",
          "preview_action",
          "row_payload",
          "detail_payload",
          "staged_operation_status"
        ],
        "type": "object"
      },
      "PreviewStagedOperationListResponse": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/StagedOperationResponse"
            },
            "type": "array"
          },
          "meta": {
            "$ref": "#/components/schemas/PreviewStagedOperationMeta"
          }
        },
        "required": [
          "data",
          "meta"
        ],
        "type": "object"
      },
      "PreviewStagedOperationMeta": {
        "properties": {
          "active_statuses": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "count": {
            "minimum": 0,
            "type": "integer"
          },
          "limit": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "count",
          "limit",
          "active_statuses"
        ],
        "type": "object"
      },
      "PreviewStateOut": {
        "properties": {
          "entity_count": {
            "format": "int64",
            "type": "integer"
          },
          "preview_enabled_by_default": {
            "type": "boolean"
          },
          "staged_operation_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "preview_enabled_by_default",
          "staged_operation_count",
          "entity_count"
        ],
        "type": "object"
      },
      "ProfileResponse": {
        "properties": {
          "business_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "legal_entity_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "onboarding_tour": {
            "description": "Normalized guided-tour progress; always a full object (defaults applied).",
            "type": "object"
          },
          "sie4_file_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "onboarding_tour"
        ],
        "type": "object"
      },
      "ProfileUpdateRequest": {
        "properties": {
          "business_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "legal_entity_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "sie4_file_url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ProviderCatalogCredentialFieldResponse": {
        "properties": {
          "label": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "placeholder": {
            "type": [
              "string",
              "null"
            ]
          },
          "secret": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "label",
          "secret"
        ],
        "type": "object"
      },
      "ProviderCatalogFeatureResponse": {
        "properties": {
          "badge": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": "string"
          },
          "icon": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "title",
          "description",
          "icon"
        ],
        "type": "object"
      },
      "ProviderCatalogFrontendSetupResponse": {
        "properties": {
          "category": {
            "type": "string"
          },
          "credential_fields": {
            "items": {
              "$ref": "#/components/schemas/ProviderCatalogCredentialFieldResponse"
            },
            "type": "array"
          },
          "detail": {
            "type": "string"
          },
          "docs_href": {
            "type": [
              "string",
              "null"
            ]
          },
          "featured": {
            "type": "boolean"
          },
          "features": {
            "items": {
              "$ref": "#/components/schemas/ProviderCatalogFeatureResponse"
            },
            "type": "array"
          },
          "icon": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "logo": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "type": "string"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "kind",
          "category",
          "summary",
          "detail",
          "tags",
          "featured",
          "icon",
          "credential_fields",
          "features"
        ],
        "type": "object"
      },
      "ProviderCatalogItemResponse": {
        "properties": {
          "allowed_execution_scopes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "capabilities": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "credential_modes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "default_adapter_id": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "frontend_setup": {
            "$ref": "#/components/schemas/ProviderCatalogFrontendSetupResponse"
          },
          "provider_id": {
            "type": "string"
          },
          "supported_archetypes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "supported_canonical_contracts": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "supports_tenant_profiles": {
            "type": "boolean"
          }
        },
        "required": [
          "provider_id",
          "display_name",
          "credential_modes",
          "capabilities",
          "supported_archetypes",
          "supported_canonical_contracts",
          "default_adapter_id",
          "allowed_execution_scopes",
          "supports_tenant_profiles",
          "frontend_setup"
        ],
        "type": "object"
      },
      "ProviderCatalogResponse": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/ProviderCatalogItemResponse"
            },
            "type": "array"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "url"
        ],
        "type": "object"
      },
      "ProviderConnectResponse": {
        "properties": {
          "provider": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "provider"
        ],
        "type": "object"
      },
      "ProviderConnectionCreateRequest": {
        "properties": {
          "aggregation_mode": {
            "description": "How the platform feed groups journal entries\n(`per_transaction` | `daily_summary` | `payout`). Optional; defaults to\nper-transaction. An activated accounting-flow rule set overrides it.",
            "type": [
              "string",
              "null"
            ]
          },
          "credentials": {},
          "voucher_series": {
            "description": "Active, tenant-owned voucher series used for ledger drafts produced by\nthis connection.",
            "type": "string"
          }
        },
        "required": [
          "credentials",
          "voucher_series"
        ],
        "type": "object"
      },
      "ProviderConnectionResponse": {
        "properties": {
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "provider_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "voucher_series": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "provider_id",
          "status",
          "name",
          "voucher_series"
        ],
        "type": "object"
      },
      "ProviderConnectionVoucherSeriesRequest": {
        "properties": {
          "voucher_series": {
            "type": "string"
          }
        },
        "required": [
          "voucher_series"
        ],
        "type": "object"
      },
      "ProviderDisconnectResponse": {
        "properties": {
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "ProviderLinkResponse": {
        "properties": {
          "exported_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_year": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "last_synced_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "link_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "link_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "linked_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider": {
            "type": "string"
          },
          "provider_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "voucher_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "voucher_series": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "provider"
        ],
        "type": "object"
      },
      "PublicObjectId": {
        "properties": {
          "value": {
            "type": "string"
          }
        },
        "required": [
          "value"
        ],
        "type": "object"
      },
      "PullStatus": {
        "properties": {
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_progress_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_pulled_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "progress_phase": {
            "type": [
              "string",
              "null"
            ]
          },
          "records_synced": {
            "format": "int64",
            "type": "integer"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "workflow_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "workflow_run_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ReadyResponse": {
        "properties": {
          "database": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "database"
        ],
        "type": "object"
      },
      "ReceiptApprovalRequest": {
        "properties": {
          "bank_account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "days_window": {
            "format": "int32",
            "type": "integer"
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "minimum_confidence": {
            "format": "double",
            "type": "number"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "selected_bank_transaction_id": {
            "type": "string"
          },
          "stage": {
            "type": "boolean"
          },
          "supplier_invoice_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tolerance_pct": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "selected_bank_transaction_id"
        ],
        "type": "object"
      },
      "ReceiptApprovalResponse": {
        "properties": {
          "entity_id": {
            "type": "string"
          },
          "entity_type": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "operation_status": {
            "type": "string"
          },
          "preview": {
            "type": [
              "object",
              "null"
            ]
          },
          "result": {
            "type": [
              "object",
              "null"
            ]
          },
          "verification": {
            "type": "object"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "operation",
          "entity_type",
          "entity_id",
          "operation_status",
          "verification",
          "warnings"
        ],
        "type": "object"
      },
      "ReceiptCandidateResponse": {
        "properties": {
          "candidates": {
            "items": {
              "type": "object"
            },
            "type": "array"
          },
          "criteria": {
            "type": "object"
          },
          "entity_id": {
            "type": "string"
          },
          "entity_type": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "operation_status": {
            "type": "string"
          },
          "preview": {
            "type": [
              "object",
              "null"
            ]
          },
          "target": {
            "type": "object"
          },
          "verification": {
            "type": "object"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "operation",
          "entity_type",
          "entity_id",
          "operation_status",
          "target",
          "criteria",
          "candidates",
          "verification",
          "warnings"
        ],
        "type": "object"
      },
      "ReceiptCandidateSearchRequest": {
        "properties": {
          "days_window": {
            "format": "int32",
            "type": "integer"
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplier_invoice_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tolerance_pct": {
            "format": "double",
            "type": "number"
          }
        },
        "type": "object"
      },
      "ReceiptConfirmationRequest": {
        "properties": {
          "candidate_bank_transaction_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "days_window": {
            "format": "int32",
            "type": "integer"
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplier_invoice_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tolerance_pct": {
            "format": "double",
            "type": "number"
          }
        },
        "type": "object"
      },
      "ReceiptConfirmationResponse": {
        "properties": {
          "candidates": {
            "items": {
              "type": "object"
            },
            "type": "array"
          },
          "confirmation": {
            "type": "object"
          },
          "criteria": {
            "type": "object"
          },
          "entity_id": {
            "type": "string"
          },
          "entity_type": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "operation_status": {
            "type": "string"
          },
          "preview": {
            "type": [
              "object",
              "null"
            ]
          },
          "target": {
            "type": "object"
          },
          "verification": {
            "type": "object"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "operation",
          "entity_type",
          "entity_id",
          "operation_status",
          "target",
          "criteria",
          "candidates",
          "confirmation",
          "verification",
          "warnings"
        ],
        "type": "object"
      },
      "ReconcileStageBody": {
        "properties": {
          "bank_account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_transaction_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "$ref": "#/components/schemas/ModeWire"
          },
          "pairs": {
            "items": {
              "$ref": "#/components/schemas/PairWire"
            },
            "type": "array"
          },
          "requires_approval": {
            "type": "boolean"
          },
          "supplier_invoice_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "tolerance": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "mode"
        ],
        "type": "object"
      },
      "ReferenceKbHealthResponse": {
        "properties": {
          "configured": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "qdrant_collection": {
            "type": "string"
          }
        },
        "required": [
          "configured",
          "enabled",
          "qdrant_collection"
        ],
        "type": "object"
      },
      "ReferenceKbOverviewOut": {
        "properties": {
          "company_documents": {
            "items": {
              "$ref": "#/components/schemas/CompanyReferenceDocumentOut"
            },
            "type": "array"
          },
          "qdrant_configured": {
            "type": "boolean"
          },
          "sources": {
            "items": {
              "$ref": "#/components/schemas/ReferenceSourceOut"
            },
            "type": "array"
          },
          "upload_max_bytes": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "sources",
          "company_documents",
          "qdrant_configured",
          "upload_max_bytes"
        ],
        "type": "object"
      },
      "ReferenceSearchRequest": {
        "properties": {
          "include_shared": {
            "type": "boolean"
          },
          "jurisdiction": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "limit": {
            "format": "int64",
            "type": "integer"
          },
          "query": {
            "type": "string"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "source_ids": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "valid_on": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "query"
        ],
        "type": "object"
      },
      "ReferenceSearchResponse": {
        "properties": {
          "configured": {
            "type": "boolean"
          },
          "query": {
            "type": "string"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/ReferenceSearchResultOut"
            },
            "type": "array"
          }
        },
        "required": [
          "query",
          "results",
          "configured"
        ],
        "type": "object"
      },
      "ReferenceSearchResultOut": {
        "properties": {
          "chunk_text": {
            "type": "string"
          },
          "citation_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "content": {
            "type": "string"
          },
          "heading_path": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "page_number": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "retrieval_mode": {
            "type": "string"
          },
          "score": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "source_id": {
            "type": "string"
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "valid_from": {
            "type": [
              "string",
              "null"
            ]
          },
          "valid_to": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "content",
          "chunk_text",
          "source_id",
          "heading_path",
          "retrieval_mode"
        ],
        "type": "object"
      },
      "ReferenceSourceOut": {
        "properties": {
          "display_name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "impact": {
            "type": "string"
          },
          "ingestion_ease": {
            "type": "string"
          },
          "jurisdiction": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "last_ingested_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_ingestion_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "priority": {
            "format": "int32",
            "type": "integer"
          },
          "source_id": {
            "type": "string"
          },
          "source_type": {
            "type": "string"
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "status_label": {
            "type": "string"
          },
          "topics": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "update_cadence": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "source_id",
          "source_type",
          "display_name",
          "jurisdiction",
          "language",
          "priority",
          "topics",
          "ingestion_ease",
          "impact",
          "status_label",
          "enabled"
        ],
        "type": "object"
      },
      "ReportBackendDescriptor": {
        "properties": {
          "blockers": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "owner": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "owner",
          "status",
          "blockers"
        ],
        "type": "object"
      },
      "ReportCatalogResponse": {
        "properties": {
          "reports": {
            "items": {
              "$ref": "#/components/schemas/ReportDescriptor"
            },
            "type": "array"
          },
          "schema_version": {
            "type": "string"
          }
        },
        "required": [
          "schema_version",
          "reports"
        ],
        "type": "object"
      },
      "ReportCliAgentMapping": {
        "properties": {
          "agent_operations": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "cli_commands": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "cli_commands",
          "agent_operations"
        ],
        "type": "object"
      },
      "ReportDescriptor": {
        "properties": {
          "archive_inclusion_policy": {
            "type": "string"
          },
          "artifact_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "backend": {
            "$ref": "#/components/schemas/ReportBackendDescriptor"
          },
          "category": {
            "type": "string"
          },
          "cli_agent_mapping": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ReportCliAgentMapping"
              }
            ]
          },
          "drilldown": {
            "$ref": "#/components/schemas/ReportDrilldownDescriptor"
          },
          "name_en": {
            "type": "string"
          },
          "name_sv": {
            "type": "string"
          },
          "report_id": {
            "type": "string"
          },
          "required_parameters": {
            "items": {
              "$ref": "#/components/schemas/ReportParameterDescriptor"
            },
            "type": "array"
          },
          "source": {
            "$ref": "#/components/schemas/ReportSourceDescriptor"
          },
          "supported_accounting_methods": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "supported_legal_forms": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "report_id",
          "name_sv",
          "name_en",
          "category",
          "supported_legal_forms",
          "supported_accounting_methods",
          "required_parameters",
          "source",
          "backend",
          "artifact_types",
          "drilldown",
          "archive_inclusion_policy"
        ],
        "type": "object"
      },
      "ReportDrilldownDescriptor": {
        "properties": {
          "dimensions": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "supported": {
            "type": "boolean"
          }
        },
        "required": [
          "supported",
          "dimensions"
        ],
        "type": "object"
      },
      "ReportParameterDescriptor": {
        "properties": {
          "description": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "value_type": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value_type",
          "required",
          "description"
        ],
        "type": "object"
      },
      "ReportRunSummary": {
        "properties": {
          "authority_scope": {
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "is_latest": {
            "type": "boolean"
          },
          "period_end": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "period_start": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "report_type": {
            "type": "string"
          },
          "source_ledger_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "superseded_by_run_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "supersedes_run_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "report_type",
          "authority_scope",
          "status",
          "is_latest",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "ReportSourceDescriptor": {
        "properties": {
          "authority": {
            "type": "string"
          },
          "projection_type": {
            "type": "string"
          }
        },
        "required": [
          "authority",
          "projection_type"
        ],
        "type": "object"
      },
      "RequestContext": {
        "properties": {
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "api_version",
          "method",
          "path"
        ],
        "type": "object"
      },
      "RequestIdHeader": {
        "properties": {
          "value": {
            "description": "Diagnostic support correlation handle. Do not use it as an idempotency key,\nreplay key, cache key, workflow identity, or durable business identifier.",
            "type": "string"
          }
        },
        "required": [
          "value"
        ],
        "type": "object"
      },
      "ResolveMatchIn": {
        "properties": {
          "method": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "method"
        ],
        "type": "object"
      },
      "ResolveMatchOut": {
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status"
        ],
        "type": "object"
      },
      "ResolvePlatformFeedVatRequest": {
        "description": "Optimistic group identity sent from the preview the operator reviewed.\nEvery field must still match before any row receives resolution evidence.",
        "properties": {
          "category": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "expected_actionable_count": {
            "format": "int64",
            "type": "integer"
          },
          "vat_treatment": {
            "$ref": "#/components/schemas/PlatformFeedVatTreatment"
          }
        },
        "required": [
          "category",
          "currency",
          "country",
          "expected_actionable_count",
          "vat_treatment"
        ],
        "type": "object"
      },
      "ResolvePlatformFeedVatResponse": {
        "properties": {
          "resolved_at": {
            "format": "date-time",
            "type": "string"
          },
          "resolved_by": {
            "format": "uuid",
            "type": "string"
          },
          "resolved_count": {
            "format": "int64",
            "type": "integer"
          },
          "resolved_group_key": {
            "type": "string"
          },
          "source_group_key": {
            "type": "string"
          },
          "tax_rate": {
            "type": "string"
          },
          "vat_treatment": {
            "$ref": "#/components/schemas/PlatformFeedVatTreatment"
          }
        },
        "required": [
          "source_group_key",
          "resolved_group_key",
          "resolved_count",
          "vat_treatment",
          "tax_rate",
          "resolved_by",
          "resolved_at"
        ],
        "type": "object"
      },
      "RevaluationRequest": {
        "properties": {
          "closing_rates": {
            "type": "object"
          },
          "period_end": {
            "format": "date",
            "type": "string"
          },
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          }
        },
        "required": [
          "period_end",
          "closing_rates"
        ],
        "type": "object"
      },
      "RootResponse": {
        "properties": {
          "health": {
            "type": "string"
          },
          "service": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "service",
          "health"
        ],
        "type": "object"
      },
      "SalaryOverviewResponse": {
        "properties": {
          "all_confirmed": {
            "type": "boolean"
          },
          "employees": {
            "items": {
              "$ref": "#/components/schemas/EmployeeWageStatusResponse"
            },
            "type": "array"
          },
          "period_month": {
            "format": "int32",
            "type": "integer"
          },
          "period_year": {
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "period_year",
          "period_month",
          "employees",
          "all_confirmed"
        ],
        "type": "object"
      },
      "SaveAnalyticsQueryRequest": {
        "properties": {
          "chart_config": {},
          "column_config": {
            "items": {},
            "type": "array"
          },
          "sql_query": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "title",
          "sql_query"
        ],
        "type": "object"
      },
      "SavedAnalyticsQueryResponse": {
        "properties": {
          "chart_config": {},
          "chart_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "column_config": {
            "items": {},
            "type": "array"
          },
          "column_types": {},
          "created_at": {
            "type": "string"
          },
          "feedback": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "last_refreshed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_result": {},
          "nl_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "sql_query": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "sql_query",
          "column_config",
          "created_at"
        ],
        "type": "object"
      },
      "SavedQueriesResponse": {
        "properties": {
          "queries": {
            "items": {
              "$ref": "#/components/schemas/SavedAnalyticsQueryResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "queries"
        ],
        "type": "object"
      },
      "ScbAddressResponse": {
        "properties": {
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "co": {
            "type": [
              "string",
              "null"
            ]
          },
          "county": {
            "type": [
              "string",
              "null"
            ]
          },
          "municipality": {
            "type": [
              "string",
              "null"
            ]
          },
          "postal_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "street": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ScbBranchResponse": {
        "properties": {
          "code": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "primary": {
            "type": "boolean"
          }
        },
        "required": [
          "code",
          "description",
          "primary"
        ],
        "type": "object"
      },
      "ScbCertMetadataResponse": {
        "properties": {
          "feature_enabled": {
            "type": "boolean"
          },
          "not_after": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject_cn": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "feature_enabled"
        ],
        "type": "object"
      },
      "ScbCompanyResponse": {
        "properties": {
          "address": {
            "$ref": "#/components/schemas/ScbAddressResponse"
          },
          "company_name": {
            "type": "string"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "employee_size_class": {
            "type": [
              "string",
              "null"
            ]
          },
          "employee_size_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "industry": {
            "items": {
              "$ref": "#/components/schemas/ScbBranchResponse"
            },
            "type": "array"
          },
          "legal_form": {
            "type": [
              "string",
              "null"
            ]
          },
          "legal_form_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "org_nr": {
            "type": "string"
          },
          "ownership": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "raw": {},
          "registration_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "registration_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "sector": {
            "type": [
              "string",
              "null"
            ]
          },
          "start_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "org_nr",
          "company_name",
          "address",
          "industry",
          "raw"
        ],
        "type": "object"
      },
      "ScbCompanySearchResponse": {
        "properties": {
          "companies": {
            "items": {
              "$ref": "#/components/schemas/ScbCompanyResponse"
            },
            "type": "array"
          },
          "total": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "companies",
          "total"
        ],
        "type": "object"
      },
      "SchedulerHealthResponse": {
        "properties": {
          "schedulers": {
            "items": {
              "$ref": "#/components/schemas/SchedulerStatusResponse"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "schedulers"
        ],
        "type": "object"
      },
      "SchedulerStatusResponse": {
        "properties": {
          "interval_secs": {
            "format": "int64",
            "minimum": 0,
            "type": "integer"
          },
          "last_outcome": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TickOutcome"
              }
            ]
          },
          "last_tick_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "interval_secs"
        ],
        "type": "object"
      },
      "SemesterersattningTerminationPostingPreviewResponse": {
        "properties": {
          "balanced": {
            "type": "boolean"
          },
          "entry_request": {
            "type": "object"
          },
          "line_count": {
            "minimum": 0,
            "type": "integer"
          },
          "period_month": {
            "format": "int32",
            "type": "integer"
          },
          "period_year": {
            "format": "int32",
            "type": "integer"
          },
          "posting_intent": {
            "type": "object"
          },
          "recipient_count": {
            "minimum": 0,
            "type": "integer"
          },
          "total_credit": {
            "format": "double",
            "type": "number"
          },
          "total_current_year_vacation_pay": {
            "format": "double",
            "type": "number"
          },
          "total_debit": {
            "format": "double",
            "type": "number"
          },
          "total_employer_contribution": {
            "format": "double",
            "type": "number"
          },
          "total_forskott_offset_applied": {
            "format": "double",
            "type": "number"
          },
          "total_gross_before_forskott_offset": {
            "format": "double",
            "type": "number"
          },
          "total_gross_settlement": {
            "format": "double",
            "type": "number"
          },
          "total_net_pay": {
            "format": "double",
            "type": "number"
          },
          "total_saved_vacation_pay": {
            "format": "double",
            "type": "number"
          },
          "total_social_charge_liability_dissolved": {
            "format": "double",
            "type": "number"
          },
          "total_vacation_liability_dissolved": {
            "format": "double",
            "type": "number"
          },
          "total_withheld_tax": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "period_year",
          "period_month",
          "recipient_count",
          "line_count",
          "total_debit",
          "total_credit",
          "balanced",
          "total_current_year_vacation_pay",
          "total_saved_vacation_pay",
          "total_gross_before_forskott_offset",
          "total_forskott_offset_applied",
          "total_gross_settlement",
          "total_withheld_tax",
          "total_net_pay",
          "total_employer_contribution",
          "total_vacation_liability_dissolved",
          "total_social_charge_liability_dissolved",
          "posting_intent",
          "entry_request"
        ],
        "type": "object"
      },
      "SemesterersattningTerminationPostingRequest": {
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_date": {
            "format": "date",
            "type": "string"
          },
          "recipients": {
            "items": {
              "$ref": "#/components/schemas/SemesterersattningTerminationRecipientRequest"
            },
            "type": "array"
          },
          "termination_date": {
            "format": "date",
            "type": "string"
          }
        },
        "required": [
          "termination_date",
          "payment_date",
          "recipients"
        ],
        "type": "object"
      },
      "SemesterersattningTerminationRecipientRequest": {
        "properties": {
          "current_year_vacation_days": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "employee_id": {
            "format": "uuid",
            "type": "string"
          },
          "employer_initiated_non_personal_reasons": {
            "type": "boolean"
          },
          "forskott_age_years": {
            "format": "int32",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "forskott_semester_pay": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "prior_social_charge_liability": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "prior_vacation_liability": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "saved_vacation_days": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "source_document_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "vacation_day_value": {
            "description": "Must be positive when current_year_vacation_days or saved_vacation_days is positive.",
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "withholding_engangsbelopp_annual_income": {
            "format": "double",
            "minimum": 0,
            "type": [
              "number",
              "null"
            ]
          },
          "withholding_engangsbelopp_table": {
            "type": [
              "string",
              "null"
            ]
          },
          "withholding_jamkning_rate": {
            "format": "double",
            "maximum": 1,
            "minimum": 0,
            "type": [
              "number",
              "null"
            ]
          },
          "withholding_method": {
            "type": "string"
          }
        },
        "required": [
          "employee_id",
          "current_year_vacation_days",
          "vacation_day_value",
          "withholding_method"
        ],
        "type": "object"
      },
      "SemesterloneskuldPostingPreviewResponse": {
        "properties": {
          "balanced": {
            "type": "boolean"
          },
          "entry_request": {
            "type": "object"
          },
          "line_count": {
            "minimum": 0,
            "type": "integer"
          },
          "period_month": {
            "format": "int32",
            "type": "integer"
          },
          "period_year": {
            "format": "int32",
            "type": "integer"
          },
          "posting_intent": {
            "type": "object"
          },
          "recipient_count": {
            "minimum": 0,
            "type": "integer"
          },
          "total_credit": {
            "format": "double",
            "type": "number"
          },
          "total_current_social_charge_liability": {
            "format": "double",
            "type": "number"
          },
          "total_current_vacation_liability": {
            "format": "double",
            "type": "number"
          },
          "total_debit": {
            "format": "double",
            "type": "number"
          },
          "total_social_charge_liability_delta": {
            "format": "double",
            "type": "number"
          },
          "total_vacation_liability_delta": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "period_year",
          "period_month",
          "recipient_count",
          "line_count",
          "total_debit",
          "total_credit",
          "balanced",
          "total_current_vacation_liability",
          "total_current_social_charge_liability",
          "total_vacation_liability_delta",
          "total_social_charge_liability_delta",
          "posting_intent",
          "entry_request"
        ],
        "type": "object"
      },
      "SemesterloneskuldPostingRequest": {
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "recipients": {
            "items": {
              "$ref": "#/components/schemas/SemesterloneskuldRecipientRequest"
            },
            "type": "array"
          }
        },
        "required": [
          "recipients"
        ],
        "type": "object"
      },
      "SemesterloneskuldRecipientRequest": {
        "additionalProperties": false,
        "properties": {
          "current_vacation_liability": {
            "format": "double",
            "minimum": 0,
            "type": [
              "number",
              "null"
            ]
          },
          "employee_id": {
            "format": "uuid",
            "type": "string"
          },
          "had_non_qualifying_absence": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "prefer_sammaloneregeln": {
            "type": "boolean"
          },
          "prior_social_charge_liability": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "prior_vacation_liability": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "source_document_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "sysselsattningsgrad_changed": {
            "type": "boolean"
          },
          "vacation_days": {
            "format": "int32",
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "vacation_qualifying_pay": {
            "format": "double",
            "minimum": 0,
            "type": [
              "number",
              "null"
            ]
          },
          "variable_pay": {
            "format": "double",
            "minimum": 0,
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "employee_id"
        ],
        "type": "object"
      },
      "SensitiveEmployeeAccessAction": {
        "enum": [
          "reveal",
          "copy"
        ],
        "type": "string"
      },
      "SensitiveEmployeeAccessRequest": {
        "properties": {
          "action": {
            "$ref": "#/components/schemas/SensitiveEmployeeAccessAction"
          },
          "field": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "action"
        ],
        "type": "object"
      },
      "SensitiveEmployeeAccessResponse": {
        "properties": {
          "employee": {
            "$ref": "#/components/schemas/EmployeeResponse"
          },
          "expires_at": {
            "type": "string"
          }
        },
        "required": [
          "employee",
          "expires_at"
        ],
        "type": "object"
      },
      "ShopifyConnectionResponse": {
        "properties": {
          "connection_id": {
            "description": "The integration connection id \u2014 the handle for the platform-feed\nruns/balance endpoints. Absent until connected.",
            "format": "uuid",
            "type": "string"
          },
          "shop_domain": {
            "description": "The connected shop domain, when connected.",
            "type": "string"
          },
          "status": {
            "description": "`not_connected` | `active` | `reauth_required` | `disabled`.",
            "type": "string"
          },
          "voucher_series": {
            "description": "Voucher series used by ledger drafts created from this Shopify feed.",
            "type": "string"
          }
        },
        "required": [
          "connection_id",
          "status",
          "shop_domain",
          "voucher_series"
        ],
        "type": "object"
      },
      "ShopifyVoucherSeriesRequest": {
        "properties": {
          "voucher_series": {
            "type": "string"
          }
        },
        "required": [
          "voucher_series"
        ],
        "type": "object"
      },
      "SieExportArtifactListResponse": {
        "properties": {
          "artifacts": {
            "items": {
              "$ref": "#/components/schemas/SieExportArtifactSummary"
            },
            "type": "array"
          }
        },
        "required": [
          "artifacts"
        ],
        "type": "object"
      },
      "SieExportArtifactSummary": {
        "description": "A persisted export artifact, sans the raw bytes (metadata view).",
        "properties": {
          "content_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "created_by": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "encoding_actual": {
            "type": [
              "string",
              "null"
            ]
          },
          "encoding_declared": {
            "type": [
              "string",
              "null"
            ]
          },
          "filename": {
            "type": [
              "string",
              "null"
            ]
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "generator_name": {
            "type": "string"
          },
          "generator_version": {
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "included_statuses": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "line_ending": {
            "type": [
              "string",
              "null"
            ]
          },
          "sha256": {
            "type": "string"
          },
          "size_bytes": {
            "format": "int64",
            "type": "integer"
          },
          "source_snapshot_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "year_end": {
            "format": "date",
            "type": "string"
          },
          "year_start": {
            "format": "date",
            "type": "string"
          }
        },
        "required": [
          "id",
          "year_start",
          "year_end",
          "size_bytes",
          "sha256",
          "generator_name",
          "generator_version",
          "included_statuses",
          "created_at"
        ],
        "type": "object"
      },
      "SieImportApplyResponse": {
        "properties": {
          "result": {
            "$ref": "#/components/schemas/SieImportApplyResult"
          },
          "staged_operation_id": {
            "format": "uuid",
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "staged_operation_id",
          "status",
          "result"
        ],
        "type": "object"
      },
      "SieImportApplyResult": {
        "properties": {
          "accounts_imported": {
            "minimum": 0,
            "type": "integer"
          },
          "company_name": {
            "type": "string"
          },
          "file_sha256": {
            "type": "string"
          },
          "import_mode": {
            "type": "string"
          },
          "opening_balance_set_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "opening_balances_set": {
            "minimum": 0,
            "type": "integer"
          },
          "version": {
            "format": "int32",
            "minimum": 0,
            "type": "integer"
          },
          "voucher_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "vouchers_imported": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "version",
          "company_name",
          "import_mode",
          "file_sha256",
          "accounts_imported",
          "opening_balances_set",
          "vouchers_imported",
          "voucher_ids"
        ],
        "type": "object"
      },
      "SieImportArtifactMetadata": {
        "properties": {
          "content_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "filename": {
            "type": [
              "string",
              "null"
            ]
          },
          "sha256": {
            "type": "string"
          },
          "size_bytes": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "size_bytes",
          "sha256",
          "created_at"
        ],
        "type": "object"
      },
      "SieImportArtifactMetadataResponse": {
        "properties": {
          "artifact": {
            "$ref": "#/components/schemas/SieImportArtifactMetadata"
          },
          "staged_operation_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "staged_operation_id",
          "artifact"
        ],
        "type": "object"
      },
      "SieImportPlanDetailResponse": {
        "properties": {
          "artifact": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SieImportArtifactMetadata"
              }
            ]
          },
          "preview": {},
          "result": {},
          "summary": {
            "$ref": "#/components/schemas/SieImportPlanSummary"
          }
        },
        "required": [
          "summary",
          "preview"
        ],
        "type": "object"
      },
      "SieImportPlanListResponse": {
        "properties": {
          "plans": {
            "items": {
              "$ref": "#/components/schemas/SieImportPlanSummary"
            },
            "type": "array"
          }
        },
        "required": [
          "plans"
        ],
        "type": "object"
      },
      "SieImportPlanSummary": {
        "properties": {
          "blocker_count": {
            "minimum": 0,
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "decoded_content_sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "executed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "file_sha256": {
            "type": "string"
          },
          "import_mode": {
            "type": "string"
          },
          "staged_operation_id": {
            "format": "uuid",
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "staged_operation_id",
          "status",
          "import_mode",
          "file_sha256",
          "blocker_count",
          "created_at"
        ],
        "type": "object"
      },
      "SieImportPreviewResponse": {
        "properties": {
          "blocker_count": {
            "minimum": 0,
            "type": "integer"
          },
          "file_sha256": {
            "type": "string"
          },
          "import_mode": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "preview": {},
          "replayed": {
            "type": "boolean"
          },
          "staged_operation_id": {
            "format": "uuid",
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "staged_operation_id",
          "replayed",
          "status",
          "operation",
          "import_mode",
          "file_sha256",
          "blocker_count",
          "preview"
        ],
        "type": "object"
      },
      "SourceControlCancelResponse": {
        "properties": {
          "cancelled_count": {
            "format": "int64",
            "type": "integer"
          },
          "exported_count": {
            "format": "int64",
            "type": "integer"
          },
          "failed_count": {
            "format": "int64",
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "run_id": {
            "type": "string"
          },
          "run_status": {
            "type": "string"
          }
        },
        "required": [
          "provider",
          "run_id",
          "run_status",
          "cancelled_count",
          "exported_count",
          "failed_count",
          "message"
        ],
        "type": "object"
      },
      "SourceControlHeadCheckRequest": {
        "properties": {
          "default_voucher_series": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "SourceControlHeadCheckResponse": {
        "properties": {
          "current_heads": {
            "additionalProperties": {
              "format": "int32",
              "type": "integer"
            },
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "expected_heads": {
            "additionalProperties": {
              "format": "int32",
              "type": "integer"
            },
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "matches": {
            "type": "boolean"
          }
        },
        "required": [
          "matches",
          "expected_heads",
          "current_heads"
        ],
        "type": "object"
      },
      "SourceControlInboxImportRequest": {
        "properties": {
          "provider_refs": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "SourceControlInboxImportResponse": {
        "properties": {
          "duplicate_count": {
            "minimum": 0,
            "type": "integer"
          },
          "failed_count": {
            "minimum": 0,
            "type": "integer"
          },
          "imported_count": {
            "minimum": 0,
            "type": "integer"
          },
          "pending_count": {
            "minimum": 0,
            "type": "integer"
          },
          "provider": {
            "type": "string"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/SourceControlInboxImportResult"
            },
            "type": "array"
          }
        },
        "required": [
          "provider",
          "pending_count",
          "imported_count",
          "duplicate_count",
          "failed_count",
          "results"
        ],
        "type": "object"
      },
      "SourceControlInboxImportResult": {
        "properties": {
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "filename": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          },
          "provider_ref": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "provider_ref",
          "status",
          "message"
        ],
        "type": "object"
      },
      "SourceControlLocalSnapshotResponse": {
        "properties": {
          "matches": {
            "type": "boolean"
          },
          "stale_items": {
            "items": {
              "$ref": "#/components/schemas/StaleLocalSnapshotItem"
            },
            "type": "array"
          }
        },
        "required": [
          "matches",
          "stale_items"
        ],
        "type": "object"
      },
      "SourceControlPayrollTimePullRequest": {
        "properties": {
          "limit": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "refresh_employees": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "SourceControlPayrollTimePushResponse": {
        "properties": {
          "exported_count": {
            "minimum": 0,
            "type": "integer"
          },
          "failed_count": {
            "minimum": 0,
            "type": "integer"
          },
          "pending_count": {
            "minimum": 0,
            "type": "integer"
          },
          "provider": {
            "type": "string"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/SourceControlPayrollTimePushResult"
            },
            "type": "array"
          },
          "skipped_count": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "provider",
          "pending_count",
          "exported_count",
          "skipped_count",
          "failed_count",
          "results"
        ],
        "type": "object"
      },
      "SourceControlPayrollTimePushResult": {
        "properties": {
          "item_id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "provider_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "item_id",
          "status",
          "message"
        ],
        "type": "object"
      },
      "SourceControlPayrollTimeReviewResponse": {
        "properties": {
          "active_run": {},
          "connected": {
            "type": "boolean"
          },
          "employee_count": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "employee_sync": {},
          "operation_status": {
            "type": "string"
          },
          "pending_import_count": {
            "format": "int64",
            "type": "integer"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "$ref": "#/components/schemas/SourceControlPayrollTimeReviewSummary"
          },
          "unsupported_reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "connected",
          "employee_sync",
          "pending_import_count",
          "summary",
          "operation_status"
        ],
        "type": "object"
      },
      "SourceControlPayrollTimeReviewSummary": {
        "properties": {
          "conflict_count": {
            "format": "int64",
            "type": "integer"
          },
          "connected": {
            "type": "boolean"
          },
          "employee_count": {
            "format": "int64",
            "type": "integer"
          },
          "employee_sync_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "employees_synced_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "exported_count": {
            "format": "int64",
            "type": "integer"
          },
          "failed_count": {
            "format": "int64",
            "type": "integer"
          },
          "mapped_employee_count": {
            "format": "int64",
            "type": "integer"
          },
          "pending_count": {
            "format": "int64",
            "type": "integer"
          },
          "pending_import_count": {
            "format": "int64",
            "type": "integer"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "push_available": {
            "type": "boolean"
          },
          "push_disabled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "ready_count": {
            "format": "int64",
            "type": "integer"
          },
          "run_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "run_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "unmapped_employee_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "connected",
          "employee_count",
          "mapped_employee_count",
          "unmapped_employee_count",
          "pending_import_count",
          "ready_count",
          "pending_count",
          "conflict_count",
          "exported_count",
          "failed_count",
          "push_available"
        ],
        "type": "object"
      },
      "SourceControlPostLedgerRequest": {
        "properties": {
          "provider_refs": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "reattempt_blocked": {
            "description": "Re-attempt posting items that previously ended up conflict/blocked/\nfailed (only those whose `provider_ref` is in `provider_refs`).\nMirrors Python `LedgerPostRequest.reattempt_blocked`.",
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "SourceControlPostLedgerResponse": {
        "properties": {
          "failed_count": {
            "minimum": 0,
            "type": "integer"
          },
          "pending_count": {
            "minimum": 0,
            "type": "integer"
          },
          "posted_count": {
            "minimum": 0,
            "type": "integer"
          },
          "provider": {
            "type": "string"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/SourceControlPostLedgerResult"
            },
            "type": "array"
          }
        },
        "required": [
          "provider",
          "pending_count",
          "posted_count",
          "failed_count",
          "results"
        ],
        "type": "object"
      },
      "SourceControlPostLedgerResult": {
        "properties": {
          "fortnox_voucher_number": {
            "description": "The Fortnox (remote) voucher number this entry corresponds to.\n`None` for failures. Mirrors Python `LedgerPostResult`.",
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "local_voucher_number": {
            "description": "The Igdrasil (local) voucher number the entry landed on \u2014 equals\n`voucher_number` unless a collision forced a fresh allocation.\n`None` for failures. Mirrors Python `LedgerPostResult`.",
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          },
          "provider_ref": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "voucher_number": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "provider_ref",
          "status",
          "message"
        ],
        "type": "object"
      },
      "SourceControlPullDispatchResponse": {
        "description": "Response for an accepted bookkeeping pull. The provider work runs in\nTemporal after this request returns; clients read the existing integration\nsync status endpoint for progress and the terminal review.",
        "properties": {
          "accepted_at": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "status": {
            "description": "Always `\"running\"` once the workflow gateway accepts the request.",
            "type": "string"
          },
          "status_url": {
            "type": "string"
          },
          "workflow_id": {
            "type": "string"
          },
          "workflow_run_id": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "workflow_id",
          "workflow_run_id",
          "accepted_at",
          "status_url",
          "provider"
        ],
        "type": "object"
      },
      "SourceControlPullRequest": {
        "properties": {
          "default_voucher_series": {
            "type": [
              "string",
              "null"
            ]
          },
          "financial_year_ids": {
            "items": {
              "format": "int32",
              "type": [
                "integer",
                "null"
              ]
            },
            "type": "array"
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "fiscal_scope": {},
          "from_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "inbox_folders": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "include_all_financial_years": {
            "type": "boolean"
          },
          "include_local_voucher_refs": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "include_missing_reversed_originals": {
            "type": "boolean"
          },
          "limit": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "to_date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "voucher_serieses": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "SourceControlPushDispatchResponse": {
        "description": "Response for the async source-control push: the push runs as a durable\nworkflow, so the request returns immediately after dispatch instead of\nholding the connection open for the whole run (which timed out at the CDN).\nClients poll `GET /ledger-entries/integration-sync/status` for live progress\nand the terminal result.",
        "properties": {
          "provider": {
            "type": "string"
          },
          "run_id": {
            "format": "uuid",
            "type": "string"
          },
          "status": {
            "description": "Always `\"running\"`.",
            "type": "string"
          },
          "workflow_id": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "run_id",
          "workflow_id",
          "provider"
        ],
        "type": "object"
      },
      "SourceControlPushRequest": {
        "properties": {
          "all": {
            "type": "boolean"
          },
          "provider_refs": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "repair_originals": {
            "type": "boolean"
          },
          "voucher_refs": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "SourceControlPushResponse": {
        "properties": {
          "exported_count": {
            "minimum": 0,
            "type": "integer"
          },
          "failed_count": {
            "minimum": 0,
            "type": "integer"
          },
          "pending_count": {
            "minimum": 0,
            "type": "integer"
          },
          "provider": {
            "type": "string"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/SourceControlPushResult"
            },
            "type": "array"
          }
        },
        "required": [
          "provider",
          "pending_count",
          "exported_count",
          "failed_count",
          "results"
        ],
        "type": "object"
      },
      "SourceControlPushResult": {
        "properties": {
          "entry_id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "voucher_number": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "entry_id",
          "status",
          "message"
        ],
        "type": "object"
      },
      "SourceControlReviewResponse": {
        "properties": {
          "active_run": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ActiveRunStatus"
              }
            ]
          },
          "connected": {
            "type": "boolean"
          },
          "operation_status": {
            "type": "string"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_voucher_count": {
            "format": "int64",
            "type": "integer"
          },
          "provider_vouchers": {
            "items": {},
            "type": "array"
          },
          "pull_status": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PullStatus"
              }
            ]
          },
          "summary": {
            "$ref": "#/components/schemas/SourceControlSummary"
          },
          "unsupported_reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "connected",
          "provider_voucher_count",
          "summary",
          "operation_status"
        ],
        "type": "object"
      },
      "SourceControlSummary": {
        "properties": {
          "conflict_count": {
            "format": "int64",
            "type": "integer"
          },
          "connected": {
            "type": "boolean"
          },
          "inbox_conflict_count": {
            "format": "int64",
            "type": "integer"
          },
          "inbox_import_available": {
            "type": "boolean"
          },
          "inbox_import_count": {
            "format": "int64",
            "type": "integer"
          },
          "inbox_import_disabled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_pulled_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_conflict_count": {
            "format": "int64",
            "type": "integer"
          },
          "ledger_post_available": {
            "type": "boolean"
          },
          "ledger_post_count": {
            "format": "int64",
            "type": "integer"
          },
          "ledger_post_disabled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "pending_count": {
            "format": "int64",
            "type": "integer"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "pull_records_synced": {
            "format": "int64",
            "type": "integer"
          },
          "pull_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "push_available": {
            "type": "boolean"
          },
          "push_disabled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "run_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "run_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "synced_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "connected",
          "pull_records_synced",
          "pending_count",
          "synced_count",
          "conflict_count",
          "ledger_post_count",
          "ledger_conflict_count",
          "inbox_import_count",
          "inbox_conflict_count",
          "push_available",
          "ledger_post_available",
          "inbox_import_available"
        ],
        "type": "object"
      },
      "StagedOperationLifecycle": {
        "description": "Derived lifecycle projection for a staged operation.\n\n`staged_operations.status` is the review/action state. This object makes\nthe accounting effect explicit so clients do not mistake a queued proposal\nfor a materialized ledger-entry draft.",
        "properties": {
          "ledger_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_entry_ref_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "needs_apply_to_create_draft": {
            "type": "boolean"
          },
          "stage": {
            "type": "string"
          },
          "voucher_materialized": {
            "type": "boolean"
          },
          "will_create_entry": {
            "type": "boolean"
          },
          "will_post": {
            "type": "boolean"
          }
        },
        "required": [
          "stage",
          "voucher_materialized",
          "will_create_entry",
          "will_post",
          "needs_apply_to_create_draft"
        ],
        "type": "object"
      },
      "StagedOperationListResponse": {
        "description": "List envelope - matches the Python `list_staged_operations` return\ndict: `{\"data\": [...], \"meta\": {count, limit, status, operation,\nrequires_approval}}` (`backend/app/staged_operations/service.py:95-104`).",
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/StagedOperationResponse"
            },
            "type": "array"
          },
          "meta": {
            "$ref": "#/components/schemas/ListMeta"
          }
        },
        "required": [
          "data",
          "meta"
        ],
        "type": "object"
      },
      "StagedOperationResponse": {
        "description": "Single-staged-operation response - matches the Python\n`serialize_staged_operation` dict shape one-for-one. Fields are\nemitted in the same order Python writes them, so field-order-sensitive\nchecks downstream stay stable.",
        "properties": {
          "approved_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "approved_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "audit_event_ids": {},
          "company_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {},
          "executed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "execution_reference_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "execution_reference_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "execution_target": {
            "type": [
              "string",
              "null"
            ]
          },
          "failed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "input": {},
          "lifecycle": {
            "$ref": "#/components/schemas/StagedOperationLifecycle"
          },
          "max_effect": {
            "type": "string"
          },
          "operation": {
            "description": "Renamed on output: stored as `operation_key`, exposed as\n`operation` to match the Python serializer.",
            "type": "string"
          },
          "preview": {},
          "rejected_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "rejected_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "requested_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "result": {},
          "risk_level": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "verification": {},
          "warnings": {}
        },
        "required": [
          "id",
          "company_id",
          "operation",
          "status",
          "risk_level",
          "requires_approval",
          "max_effect",
          "lifecycle",
          "input",
          "preview",
          "verification",
          "warnings",
          "audit_event_ids",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "StaleLocalSnapshotItem": {
        "properties": {
          "ledger_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": "string"
          },
          "run_item_id": {
            "type": "string"
          }
        },
        "required": [
          "run_item_id",
          "reason"
        ],
        "type": "object"
      },
      "StandardAccountRoleResponse": {
        "properties": {
          "account_name": {
            "type": "string"
          },
          "account_number": {
            "type": "string"
          },
          "bas_version": {
            "format": "int32",
            "minimum": 0,
            "type": "integer"
          },
          "role": {
            "type": "string"
          },
          "rule_pack_version": {
            "type": "string"
          }
        },
        "required": [
          "role",
          "account_number",
          "account_name",
          "bas_version",
          "rule_pack_version"
        ],
        "type": "object"
      },
      "StandardAccountsResponse": {
        "properties": {
          "accounts": {
            "items": {
              "$ref": "#/components/schemas/StandardAccountRoleResponse"
            },
            "type": "array"
          },
          "as_of": {
            "type": "string"
          }
        },
        "required": [
          "as_of",
          "accounts"
        ],
        "type": "object"
      },
      "StatusTotalResponse": {
        "properties": {
          "count": {
            "format": "int64",
            "type": "integer"
          },
          "signed_sum": {
            "type": "string"
          }
        },
        "required": [
          "count",
          "signed_sum"
        ],
        "type": "object"
      },
      "StripeAuthorizeUrlResponse": {
        "properties": {
          "authorize_url": {
            "description": "Stripe Connect authorize URL \u2014 the SPA redirects the browser here.",
            "type": "string"
          }
        },
        "required": [
          "authorize_url"
        ],
        "type": "object"
      },
      "StripeConnectRequest": {
        "properties": {
          "voucher_series": {
            "type": "string"
          }
        },
        "required": [
          "voucher_series"
        ],
        "type": "object"
      },
      "StripeConnectionResponse": {
        "properties": {
          "account_id": {
            "description": "The connected `acct_\u2026` id, when connected.",
            "type": [
              "string",
              "null"
            ]
          },
          "connection_id": {
            "description": "The integration connection id \u2014 the handle for the platform-feed\nruns/balance endpoints and the sync/schedule workflows. Absent until connected.",
            "format": "uuid",
            "type": "string"
          },
          "default_processing_intent": {
            "description": "`store_only` | `accounting_candidate`.",
            "type": "string"
          },
          "invoice_webhook_available": {
            "description": "Whether the platform webhook endpoint is ready to receive signed Stripe events.",
            "type": "boolean"
          },
          "invoice_webhook_enabled": {
            "description": "Whether this company opted into real-time finalized-invoice ingestion.",
            "type": "boolean"
          },
          "status": {
            "description": "`not_connected` | `active` | `reauth_required` | `disabled`.",
            "type": "string"
          },
          "voucher_series": {
            "description": "Voucher series used by ledger drafts created from this Stripe feed.",
            "type": "string"
          }
        },
        "required": [
          "connection_id",
          "status",
          "default_processing_intent",
          "invoice_webhook_enabled",
          "invoice_webhook_available",
          "voucher_series"
        ],
        "type": "object"
      },
      "StripeIntentRequest": {
        "properties": {
          "default_processing_intent": {
            "type": "string"
          }
        },
        "required": [
          "default_processing_intent"
        ],
        "type": "object"
      },
      "StripeVoucherSeriesRequest": {
        "properties": {
          "voucher_series": {
            "type": "string"
          }
        },
        "required": [
          "voucher_series"
        ],
        "type": "object"
      },
      "StripeWebhookRequest": {
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ],
        "type": "object"
      },
      "SupplierCreateRequest": {
        "properties": {
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "default_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "default_expense_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "default_payment_terms": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "zip_code": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "name"
        ],
        "type": "object"
      },
      "SupplierIdentity": {
        "additionalProperties": false,
        "properties": {
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "bankgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "default_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "plusgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplier_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "zip_code": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "SupplierInvoicePaymentQueueItemResponse": {
        "properties": {
          "attempt_count": {
            "format": "int32",
            "type": "integer"
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_attempt_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_matched_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "match_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "matched_bank_transaction_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "next_attempt_on": {
            "type": [
              "string",
              "null"
            ]
          },
          "remaining_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "strategy": {},
          "supplier_invoice_id": {
            "type": "string"
          },
          "supplier_name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "supplier_invoice_id",
          "status",
          "attempt_count",
          "strategy"
        ],
        "type": "object"
      },
      "SupplierInvoicePaymentQueueListResponse": {
        "properties": {
          "active": {
            "format": "int64",
            "type": "integer"
          },
          "entity_type": {
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/SupplierInvoicePaymentQueueItemResponse"
            },
            "type": "array"
          },
          "matched": {
            "format": "int64",
            "type": "integer"
          },
          "operation": {
            "type": "string"
          },
          "operation_status": {
            "type": "string"
          },
          "scheduled": {
            "format": "int64",
            "type": "integer"
          },
          "total": {
            "minimum": 0,
            "type": "integer"
          },
          "verification": {}
        },
        "required": [
          "items",
          "total",
          "active",
          "scheduled",
          "matched",
          "operation",
          "operation_status",
          "entity_type",
          "verification"
        ],
        "type": "object"
      },
      "SupplierInvoiceResponse": {
        "properties": {
          "created_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "invoice_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_booked": {
            "type": "boolean"
          },
          "is_cancelled": {
            "type": "boolean"
          },
          "paid_amount": {
            "type": "string"
          },
          "paid_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "registration_entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "remaining_amount": {
            "type": "string"
          },
          "reverse_charge": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "subtotal": {
            "type": "string"
          },
          "supplier": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SupplierSummaryResponse"
              }
            ]
          },
          "supplier_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_amount": {
            "type": "string"
          },
          "vat_treatment": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "status",
          "total",
          "subtotal",
          "vat_amount",
          "remaining_amount",
          "paid_amount",
          "currency",
          "reverse_charge",
          "is_booked",
          "is_cancelled"
        ],
        "type": "object"
      },
      "SupplierReference": {
        "oneOf": [
          {
            "properties": {
              "identity": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SupplierIdentity"
                  }
                ]
              },
              "kind": {
                "enum": [
                  "internal"
                ],
                "type": "string"
              },
              "supplier_id": {
                "format": "uuid",
                "type": "string"
              }
            },
            "required": [
              "supplier_id",
              "kind"
            ],
            "type": "object"
          },
          {
            "properties": {
              "external_id": {
                "type": "string"
              },
              "identity": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SupplierIdentity"
                  }
                ]
              },
              "kind": {
                "enum": [
                  "external"
                ],
                "type": "string"
              },
              "source_connection_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_system": {
                "type": "string"
              }
            },
            "required": [
              "source_system",
              "external_id",
              "kind"
            ],
            "type": "object"
          },
          {
            "properties": {
              "identity": {
                "$ref": "#/components/schemas/SupplierIdentity"
              },
              "kind": {
                "enum": [
                  "identity"
                ],
                "type": "string"
              }
            },
            "required": [
              "identity",
              "kind"
            ],
            "type": "object"
          }
        ]
      },
      "SupplierRuleResponse": {
        "description": "Current rule state for a supplier (GET /supplier-rules/{supplier_id}).",
        "properties": {
          "account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "confirmed": {
            "type": "boolean"
          },
          "confirmed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "expense_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "payable_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_account": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "confirmed"
        ],
        "type": "object"
      },
      "SupplierRuleSuggestionResponse": {
        "properties": {
          "account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry_count": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "expense_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "suggested": {
            "type": "boolean"
          }
        },
        "required": [
          "suggested"
        ],
        "type": "object"
      },
      "SupplierSummaryResponse": {
        "properties": {
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_number": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name"
        ],
        "type": "object"
      },
      "SyncCostCenterResponse": {
        "properties": {
          "active": {
            "type": "boolean"
          },
          "code": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "code",
          "active"
        ],
        "type": "object"
      },
      "SyncProjectResponse": {
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "end_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "project_number": {
            "type": "string"
          },
          "start_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "project_number"
        ],
        "type": "object"
      },
      "SyncSupplierResponse": {
        "properties": {
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "bankgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "default_expense_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "plusgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplier_number": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "supplier_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "zip_code": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "is_active"
        ],
        "type": "object"
      },
      "TableSearchMeta": {
        "properties": {
          "candidate_count": {
            "format": "int64",
            "type": "integer"
          },
          "candidate_limit": {
            "format": "int64",
            "type": "integer"
          },
          "candidate_limit_reached": {
            "type": "boolean"
          },
          "ranked_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "candidate_count",
          "candidate_limit",
          "candidate_limit_reached",
          "ranked_count"
        ],
        "type": "object"
      },
      "TelegramConnectRequest": {
        "properties": {
          "bot_token": {
            "description": "BotFather bot token, e.g. `123456789:AA...`.",
            "type": "string"
          },
          "default_processing_intent": {
            "description": "`store_only` (default) | `accounting_candidate`.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "bot_token"
        ],
        "type": "object"
      },
      "TelegramConnectionResponse": {
        "properties": {
          "bot_id": {
            "type": "string"
          },
          "bot_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "bot_username": {
            "type": [
              "string",
              "null"
            ]
          },
          "connected": {
            "type": "boolean"
          },
          "connection_id": {
            "format": "uuid",
            "type": "string"
          },
          "connection_status": {
            "type": "string"
          },
          "default_processing_intent": {
            "type": "string"
          }
        },
        "required": [
          "connection_id",
          "bot_id",
          "connected",
          "connection_status",
          "default_processing_intent"
        ],
        "type": "object"
      },
      "TelegramIntentRequest": {
        "properties": {
          "default_processing_intent": {
            "type": "string"
          }
        },
        "required": [
          "default_processing_intent"
        ],
        "type": "object"
      },
      "TenantContext": {
        "properties": {
          "company_id": {
            "format": "uuid",
            "type": "string"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject_key": {
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "company_id",
          "subject_key"
        ],
        "type": "object"
      },
      "TickOutcome": {
        "enum": [
          "ok",
          "failed"
        ],
        "type": "string"
      },
      "TimeEntryCreateRequest": {
        "properties": {
          "billable": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "client_company_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "date": {
            "format": "date",
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "start_time": {
            "format": "date-time",
            "type": "string"
          },
          "stop_time": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "start_time",
          "date"
        ],
        "type": "object"
      },
      "TimeEntryResponse": {
        "properties": {
          "billable": {
            "type": "boolean"
          },
          "billed": {
            "type": "boolean"
          },
          "client_company_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "client_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "date": {
            "format": "date",
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "duration": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "elapsed_seconds": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "invoice_item_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "start_time": {
            "format": "date-time",
            "type": "string"
          },
          "stop_time": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "start_time",
          "date",
          "billable",
          "billed",
          "currency",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "TimeEntryUpdateRequest": {
        "properties": {
          "billable": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "client_company_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "date": {
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "start_time": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "stop_time": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "TimeTrackingMetaResponse": {
        "type": "object"
      },
      "TimerStartRequest": {
        "properties": {
          "client_company_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "TransitionReportRunRequest": {
        "properties": {
          "to": {
            "description": "Target status: submitted, accepted, or rejected.",
            "type": "string"
          }
        },
        "required": [
          "to"
        ],
        "type": "object"
      },
      "UpdateAgentHarnessSettingsRequest": {
        "additionalProperties": false,
        "properties": {
          "writes_enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "writes_enabled"
        ],
        "type": "object"
      },
      "UpdateCompanyRequest": {
        "additionalProperties": false,
        "properties": {
          "accounting_method": {
            "type": [
              "string",
              "null"
            ]
          },
          "bankgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "bic": {
            "type": [
              "string",
              "null"
            ]
          },
          "business_form": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "f_skatt_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "fiscal_year_start": {
            "type": [
              "string",
              "null"
            ]
          },
          "iban": {
            "type": [
              "string",
              "null"
            ]
          },
          "legal_form": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "plusgiro": {
            "type": [
              "string",
              "null"
            ]
          },
          "requires_approval": {
            "type": "boolean"
          },
          "sender_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "boolean"
          },
          "vat_metadata_evidence": {},
          "vat_metadata_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_registration_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_reporting_period": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_reporting_start": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "UpdateSettingsRequest": {
        "properties": {
          "company_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "preferred_llm": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "UploadConfirmRequest": {
        "properties": {
          "process_id": {
            "type": "string"
          }
        },
        "required": [
          "process_id"
        ],
        "type": "object"
      },
      "UploadConfirmResponse": {
        "properties": {
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "duplicate_document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "message"
        ],
        "type": "object"
      },
      "UploadPresignRequest": {
        "properties": {
          "content_length": {
            "format": "int64",
            "minimum": 0,
            "type": "integer"
          },
          "content_type": {
            "type": "string"
          },
          "file_category": {
            "description": "Storage bucket for the file: `accounting` (default, invoices/receipts that\nmay enter the accounting pipeline), `contract`, or `other`. Non-accounting\ncategories accept a broad set of file types and are never auto-classified.",
            "type": [
              "string",
              "null"
            ]
          },
          "file_hash": {
            "description": "Lowercase or uppercase hexadecimal SHA-256 of the exact upload bytes.",
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "import_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "preview_content_length": {
            "format": "int64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "preview_file_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "processing_intent": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplier": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SupplierReference",
                "description": "Optional supplier attribution hint carried with the document into the\ncanonical accounting writer."
              }
            ]
          }
        },
        "required": [
          "filename",
          "content_type",
          "content_length",
          "file_hash"
        ],
        "type": "object"
      },
      "UploadPresignResponse": {
        "properties": {
          "checksum_sha256": {
            "description": "Base64 checksum required in the `x-amz-checksum-sha256` PUT header.",
            "type": "string"
          },
          "document_id": {
            "type": "string"
          },
          "presigned_url": {
            "type": "string"
          },
          "preview_checksum_sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "preview_presigned_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "preview_s3_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "process_id": {
            "type": "string"
          },
          "s3_key": {
            "type": "string"
          }
        },
        "required": [
          "process_id",
          "document_id",
          "presigned_url",
          "s3_key",
          "checksum_sha256"
        ],
        "type": "object"
      },
      "UploadReconcileResponse": {
        "properties": {
          "deduped": {
            "description": "Object present but content already held by an active doc \u2192 duplicate/retry.",
            "minimum": 0,
            "type": "integer"
          },
          "errored": {
            "description": "Rows skipped this pass due to a transient storage/DB error.",
            "minimum": 0,
            "type": "integer"
          },
          "failed": {
            "description": "Object missing or contract mismatch \u2192 failed (genuinely lost).",
            "minimum": 0,
            "type": "integer"
          },
          "mode": {
            "description": "Echo of the effective mode (`dry_run` | `apply`).",
            "type": "string"
          },
          "promoted": {
            "description": "Object present in storage \u2192 promoted to `uploaded` (recoverable).",
            "minimum": 0,
            "type": "integer"
          },
          "scanned": {
            "description": "Stranded `uploading` rows examined.",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "mode",
          "scanned",
          "promoted",
          "deduped",
          "failed",
          "errored"
        ],
        "type": "object"
      },
      "UpsertRoutingRuleRequest": {
        "properties": {
          "account_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_account_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "bic": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "iban": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "ledger_account_number": {
            "type": "string"
          },
          "match_fields": {},
          "source_payload": {}
        },
        "required": [
          "ledger_account_number"
        ],
        "type": "object"
      },
      "UsageByActionResponse": {
        "properties": {
          "action": {
            "type": "string"
          },
          "calls": {
            "format": "int64",
            "type": "integer"
          },
          "total_tokens": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "action",
          "total_tokens",
          "calls"
        ],
        "type": "object"
      },
      "UsageTotalsResponse": {
        "properties": {
          "calls": {
            "format": "int64",
            "type": "integer"
          },
          "input_tokens": {
            "format": "int64",
            "type": "integer"
          },
          "output_tokens": {
            "format": "int64",
            "type": "integer"
          },
          "total_tokens": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "input_tokens",
          "output_tokens",
          "total_tokens",
          "calls"
        ],
        "type": "object"
      },
      "UserContext": {
        "properties": {
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject_key": {
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "subject_key"
        ],
        "type": "object"
      },
      "UserProfileResponse": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "created_at"
        ],
        "type": "object"
      },
      "UserSettingsResponse": {
        "properties": {
          "company_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          },
          "org_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "preferred_llm": {
            "type": "string"
          }
        },
        "required": [
          "email",
          "preferred_llm"
        ],
        "type": "object"
      },
      "UserUsageResponse": {
        "properties": {
          "by_action": {
            "items": {
              "$ref": "#/components/schemas/UsageByActionResponse"
            },
            "type": "array"
          },
          "daily": {
            "items": {
              "$ref": "#/components/schemas/DailyUsageResponse"
            },
            "type": "array"
          },
          "days": {
            "format": "int64",
            "type": "integer"
          },
          "totals": {
            "$ref": "#/components/schemas/UsageTotalsResponse"
          },
          "user_id": {
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "days",
          "totals",
          "by_action",
          "daily"
        ],
        "type": "object"
      },
      "ValidateAnalyticsQueryRequest": {
        "properties": {
          "sql_query": {
            "type": "string"
          }
        },
        "required": [
          "sql_query"
        ],
        "type": "object"
      },
      "VismaConnectResponse": {
        "properties": {
          "authorization_url": {
            "type": "string"
          }
        },
        "required": [
          "authorization_url"
        ],
        "type": "object"
      },
      "VoucherSeriesSuggestLineInput": {
        "description": "One draft posting line for the voucher-series suggestion. Only the account\nand which side(s) carry an amount matter to the rule-pack suggester.",
        "properties": {
          "account_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit": {
            "type": "string"
          },
          "debit": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "VoucherSeriesSuggestRequest": {
        "description": "Ask the engine which verification series a draft entry looks like. The\nsuggestion is rule-owned (`accounting-rules`) and resolved against the\ncompany's active fiscal-period registry.",
        "properties": {
          "entry_date": {
            "description": "Date the entry is being booked on; selects the fiscal period. Defaults\nto today when omitted.",
            "format": "date",
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/VoucherSeriesSuggestLineInput"
            },
            "type": "array"
          },
          "source_type": {
            "description": "Originating workflow/source type, if known (e.g. `manual`,\n`supplier_invoice`). Drives the suggestion before account content.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "VoucherSeriesSuggestionResponse": {
        "description": "Suggested verification series plus why it was chosen.",
        "properties": {
          "basis": {
            "description": "How the series was chosen: `workflow`, `account_content`, or\n`general_default`.",
            "type": "string"
          },
          "code": {
            "description": "Resolved series code (company registry where available, else the rule\ndefault), e.g. `D`.",
            "type": "string"
          },
          "fiscal_period_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "intended_use": {
            "description": "Canonical intended-use prose for the series.",
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "reason": {
            "description": "Human-readable explanation for the suggestion.",
            "type": "string"
          },
          "workflow_family": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "name",
          "intended_use",
          "workflow_family",
          "reason",
          "basis"
        ],
        "type": "object"
      },
      "WagePeriodCreateRequest": {
        "additionalProperties": false,
        "properties": {
          "period_month": {
            "format": "int32",
            "type": "integer"
          },
          "period_year": {
            "format": "int32",
            "type": "integer"
          },
          "raw_input_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "structured_data": {
            "type": [
              "object",
              "null"
            ]
          }
        },
        "required": [
          "period_year",
          "period_month"
        ],
        "type": "object"
      },
      "WagePeriodParseResponse": {
        "properties": {
          "hours_worked": {
            "format": "double",
            "minimum": 0,
            "type": [
              "number",
              "null"
            ]
          },
          "own_expenses": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "structured_data": {},
          "usage": {}
        },
        "required": [
          "structured_data",
          "own_expenses",
          "usage"
        ],
        "type": "object"
      },
      "WagePeriodResponse": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "employee_id": {
            "type": "string"
          },
          "hours_worked": {
            "format": "double",
            "minimum": 0,
            "type": [
              "number",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "other_costs": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "own_expenses": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "payslip_s3_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "period_month": {
            "format": "int32",
            "type": "integer"
          },
          "period_year": {
            "format": "int32",
            "type": "integer"
          },
          "raw_input_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "structured_data": {},
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "employee_id",
          "period_year",
          "period_month",
          "own_expenses",
          "other_costs",
          "status",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "WagePeriodUpdateRequest": {
        "additionalProperties": false,
        "properties": {
          "raw_input_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "pattern": "^(draft|confirmed)$",
            "type": [
              "string",
              "null"
            ]
          },
          "structured_data": {
            "type": [
              "object",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "WhatsAppSenderRequest": {
        "properties": {
          "default_processing_intent": {
            "type": "string"
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_user_id": {
            "type": "string"
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "external_user_id",
          "default_processing_intent"
        ],
        "type": "object"
      },
      "WhatsAppSenderResponse": {
        "properties": {
          "active_company": {
            "type": "boolean"
          },
          "company_id": {
            "type": "string"
          },
          "default_processing_intent": {
            "type": "string"
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_user_id": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "last_seen_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "linked_at": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "user_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "company_id",
          "external_user_id",
          "status",
          "default_processing_intent",
          "active_company",
          "linked_at"
        ],
        "type": "object"
      },
      "YearEndRequest": {
        "properties": {
          "fiscal_period_id": {
            "format": "uuid",
            "type": "string"
          },
          "requires_approval": {
            "type": "boolean"
          },
          "stage": {
            "type": "boolean"
          }
        },
        "required": [
          "fiscal_period_id"
        ],
        "type": "object"
      },
      "ZettleConnectRequest": {
        "properties": {
          "api_key": {
            "type": "string"
          },
          "client_id": {
            "type": "string"
          }
        },
        "required": [
          "client_id",
          "api_key"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "clerk_bearer": {
        "bearerFormat": "JWT",
        "description": "Clerk-issued bearer token passed in the Authorization header.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Rust-owned Igdrasil accounting API for product, CLI, integration, and workflow contracts.",
    "license": {
      "name": ""
    },
    "title": "Igdrasil Rust API",
    "version": "0.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1": {
      "get": {
        "operationId": "root",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RootResponse"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "health"
        ]
      }
    },
    "/api/v1/accounting-entries": {
      "get": {
        "operationId": "list_accounting_entries",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "intent",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "ready_to_post",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "account_number",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_AccountingEntryResponse"
                }
              }
            },
            "description": "The company's accounting entries, newest first",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ]
      },
      "post": {
        "operationId": "create_accounting_entry",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingEntryCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The created draft entry (or staged operation) in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry create staging conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-entries",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/active-provider": {
      "get": {
        "operationId": "active_provider",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActiveProviderResponse"
                }
              }
            },
            "description": "Active accounting integration provider",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ]
      }
    },
    "/api/v1/accounting-entries/query": {
      "post": {
        "operationId": "query_accounting_entries",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListEntriesBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_AccountingEntryResponse"
                }
              }
            },
            "description": "The company's accounting entries, newest first",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-entries/query",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/search": {
      "get": {
        "operationId": "search_accounting_entries",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_Value"
                }
              }
            },
            "description": "Matching search-view rows in relevance order",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ]
      }
    },
    "/api/v1/accounting-entries/search-corpus": {
      "get": {
        "operationId": "list_accounting_entry_search_corpus",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "max_text_chars",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_Value"
                }
              }
            },
            "description": "The company's search-view corpus rows, newest first",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ]
      }
    },
    "/api/v1/accounting-entries/table": {
      "get": {
        "operationId": "list_accounting_entries_table",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "intent",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "ready_to_post",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "account_number",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Comma-separated voucher-series codes (e.g. `A,C`). Filters server-side\nbefore pagination so results aren't limited to the series that happen\nto appear in the current page of the global date-sorted list.",
            "in": "query",
            "name": "voucher_series",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_by",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort_dir",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingEntryTableResponse"
                }
              }
            },
            "description": "A page of accounting entries with pagination metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ]
      }
    },
    "/api/v1/accounting-entries/voucher-series/{voucher_series}/latest": {
      "delete": {
        "operationId": "delete_latest_entry_in_voucher_series",
        "parameters": [
          {
            "description": "Voucher series whose latest voucher should be deleted",
            "in": "path",
            "name": "voucher_series",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Must be true to delete a posted/reversed voucher",
            "in": "query",
            "name": "confirm",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Latest voucher deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Voucher cannot be deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Confirmation is missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/accounting-entries/voucher-series/{voucher_series}/latest",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/{entry_id}": {
      "delete": {
        "operationId": "delete_entry_if_latest_in_series",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Must be true to delete a posted/reversed voucher",
            "in": "query",
            "name": "confirm",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Latest voucher deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Voucher cannot be deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Confirmation is missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/accounting-entries/{entry_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "get": {
        "operationId": "get_accounting_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingEntryResponse"
                }
              }
            },
            "description": "The accounting entry with its links and source documents",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ]
      },
      "patch": {
        "operationId": "update_accounting_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingEntryUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The updated entry (or staged operation) in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry update conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/accounting-entries/{entry_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/{entry_id}/complete": {
      "post": {
        "operationId": "complete_accounting_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingEntryCompleteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The completed entry (or staged operation) in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be completed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry completion conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-entries/{entry_id}/complete",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/{entry_id}/correct": {
      "post": {
        "operationId": "correct_accounting_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingEntryCorrectRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The correction entry (or staged operation) in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be corrected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry correction conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-entries/{entry_id}/correct",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/{entry_id}/documents": {
      "post": {
        "operationId": "attach_accounting_entry_document",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AttachEntryDocumentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingEntryResponse"
                }
              }
            },
            "description": "The entry with its refreshed source_document_ids",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Source document not found for this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-entries/{entry_id}/documents",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/{entry_id}/documents/{document_id}": {
      "delete": {
        "operationId": "detach_accounting_entry_document",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Source document UUID to detach",
            "in": "path",
            "name": "document_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingEntryResponse"
                }
              }
            },
            "description": "The entry with its refreshed source_document_ids",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/accounting-entries/{entry_id}/documents/{document_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/{entry_id}/links": {
      "post": {
        "operationId": "create_accounting_entry_link",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingEntryLinkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The linked entry (or staged operation) in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be linked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry link conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-entries/{entry_id}/links",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/{entry_id}/post": {
      "post": {
        "operationId": "post_accounting_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "stage",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "export_external",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The posted entry (or staged operation) in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be posted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry post conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-entries/{entry_id}/post",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/{entry_id}/reject": {
      "post": {
        "operationId": "reject_accounting_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "stage",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The rejected entry (or staged operation) in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be rejected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry reject conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-entries/{entry_id}/reject",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/{entry_id}/reverse": {
      "post": {
        "operationId": "reverse_accounting_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingEntryReverseRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The reversal entry (or staged operation) in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be reversed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry reverse conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-entries/{entry_id}/reverse",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-entries/{entry_id}/timeline": {
      "get": {
        "operationId": "get_accounting_entry_timeline",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingEntryTimelineResponse"
                }
              }
            },
            "description": "The entry, its related entries, and referenced resources",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accounting entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-entries"
        ]
      }
    },
    "/api/v1/accounting-flows": {
      "get": {
        "operationId": "list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingFlowListResponse"
                }
              }
            },
            "description": "Accounting flows projected from provider catalog and active tenant profiles",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-flows"
        ]
      }
    },
    "/api/v1/accounting-flows/archetypes": {
      "get": {
        "operationId": "list_archetypes",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingFlowArchetypeListResponse"
                }
              }
            },
            "description": "Fixed accounting flow archetypes",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-flows"
        ]
      }
    },
    "/api/v1/accounting-flows/catalog": {
      "get": {
        "operationId": "get_catalog",
        "parameters": [
          {
            "description": "Rule resolution date (`YYYY-MM-DD`). Defaults to today.",
            "in": "query",
            "name": "as_of",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Company tenant UUID selected by the Clerk-authenticated caller",
            "in": "header",
            "name": "X-Company-Id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingFlowCatalogResponse"
                }
              }
            },
            "description": "Provider accounting catalog with role pairs resolved to dated BAS accounts",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid as_of date or unresolvable catalog role",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-flows"
        ]
      }
    },
    "/api/v1/accounting-flows/templates": {
      "get": {
        "operationId": "list_templates",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingFlowTemplateListResponse"
                }
              }
            },
            "description": "Reusable accounting flow rule-set templates for the tenant",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-flows"
        ]
      }
    },
    "/api/v1/accounting-flows/{provider_id}/{archetype}/activate": {
      "post": {
        "operationId": "activate",
        "parameters": [
          {
            "description": "Provider id",
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Accounting flow archetype",
            "in": "path",
            "name": "archetype",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingFlowActivateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingFlowRuleSetResponse"
                }
              }
            },
            "description": "Activated accounting flow rule set",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported accounting flow or version",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Owner or admin membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Rule set not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-flows"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-flows/{provider_id}/{archetype}/activate",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-flows/{provider_id}/{archetype}/apply-template": {
      "post": {
        "operationId": "apply_template",
        "parameters": [
          {
            "description": "Provider id",
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Accounting flow archetype",
            "in": "path",
            "name": "archetype",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingFlowTemplateApplyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingFlowRuleSetResponse"
                }
              }
            },
            "description": "Draft accounting flow rule set copied from the selected template",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported accounting flow or invalid template",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Owner or admin membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Template not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-flows"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-flows/{provider_id}/{archetype}/apply-template",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-flows/{provider_id}/{archetype}/deactivate": {
      "post": {
        "operationId": "deactivate",
        "parameters": [
          {
            "description": "Provider id",
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Accounting flow archetype",
            "in": "path",
            "name": "archetype",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingFlowRuleSetResponse"
                }
              }
            },
            "description": "Deactivated accounting flow rule set",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Owner or admin membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No active rule set",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-flows"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-flows/{provider_id}/{archetype}/deactivate",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-flows/{provider_id}/{archetype}/rule-set": {
      "get": {
        "operationId": "get_rule_set",
        "parameters": [
          {
            "description": "Provider id",
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Accounting flow archetype",
            "in": "path",
            "name": "archetype",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "version",
            "required": false,
            "schema": {
              "format": "int32",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingFlowRuleSetResponse"
                }
              }
            },
            "description": "Latest or requested accounting flow rule set",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported accounting flow",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Rule set not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-flows"
        ]
      },
      "put": {
        "operationId": "put_rule_set",
        "parameters": [
          {
            "description": "Provider id",
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Accounting flow archetype",
            "in": "path",
            "name": "archetype",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingFlowRuleSetRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingFlowRuleSetResponse"
                }
              }
            },
            "description": "Versioned accounting flow rule set",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported accounting flow",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Owner or admin membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-flows"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/accounting-flows/{provider_id}/{archetype}/rule-set",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-flows/{provider_id}/{archetype}/templates": {
      "post": {
        "operationId": "create_template",
        "parameters": [
          {
            "description": "Provider id",
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Accounting flow archetype",
            "in": "path",
            "name": "archetype",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingFlowTemplateCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingFlowTemplateResponse"
                }
              }
            },
            "description": "Reusable accounting flow rule-set template",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported accounting flow or invalid template",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Owner or admin membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-flows"
        ],
        "x-idempotency-debt-id": "POST /api/v1/accounting-flows/{provider_id}/{archetype}/templates",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-hub/customers": {
      "get": {
        "operationId": "list_customers",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_AccountingCustomerRowResponse"
                }
              }
            },
            "description": "Accounting hub customers ordered by name",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-hub"
        ]
      }
    },
    "/api/v1/accounting-hub/customers/{customer_id}": {
      "get": {
        "operationId": "get_customer_detail",
        "parameters": [
          {
            "description": "Customer ID",
            "in": "path",
            "name": "customer_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDetailResponse"
                }
              }
            },
            "description": "Accounting hub customer detail",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-hub"
        ]
      },
      "put": {
        "operationId": "update_customer",
        "parameters": [
          {
            "description": "Customer ID",
            "in": "path",
            "name": "customer_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {}
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDetailResponse"
                }
              }
            },
            "description": "Accounting hub customer detail",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid customer update",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-hub"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/accounting-hub/customers/{customer_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/accounting-hub/suppliers": {
      "get": {
        "operationId": "list_suppliers",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_AccountingSupplierRowResponse"
                }
              }
            },
            "description": "Accounting hub suppliers ordered by name",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-hub"
        ]
      },
      "post": {
        "operationId": "create_supplier",
        "parameters": [
          {
            "description": "Company tenant UUID selected by the Clerk-authenticated caller",
            "in": "header",
            "name": "X-Company-Id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Client-generated retry key for this mutating request",
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional diagnostic request ID returned on the response",
            "in": "header",
            "name": "X-Request-Id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingSupplierRowResponse"
                }
              }
            },
            "description": "Supplier created",
            "headers": {
              "Idempotent-Replayed": {
                "description": "Present and true when this response is an idempotency replay",
                "schema": {
                  "type": "boolean"
                }
              },
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid or duplicate supplier",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Idempotency key is already in flight",
            "headers": {
              "Retry-After": {
                "description": "Present when error.code is idempotency_key_in_use",
                "schema": {
                  "type": "string"
                }
              },
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Idempotency key payload mismatch",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Idempotency storage unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "accounting-hub"
        ],
        "x-idempotency-policy": "required"
      }
    },
    "/api/v1/analytics/ask": {
      "post": {
        "operationId": "ask",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnalyticsAskRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsAskResponse"
                }
              }
            },
            "description": "Natural-language analytics answer",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Question is missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Question could not be answered",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Analytics runtime error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Analytics ask or readonly execution is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ],
        "x-idempotency-debt-id": "POST /api/v1/analytics/ask",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/analytics/saved-queries": {
      "get": {
        "operationId": "list_saved_queries",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedQueriesResponse"
                }
              }
            },
            "description": "Saved analytics queries for the current company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ]
      },
      "post": {
        "operationId": "save_query",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveAnalyticsQueryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedAnalyticsQueryResponse"
                }
              }
            },
            "description": "Saved analytics query created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Saved query failed analytics validation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Readonly analytics execution is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ],
        "x-idempotency-debt-id": "POST /api/v1/analytics/saved-queries",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/analytics/saved-queries/validate": {
      "post": {
        "operationId": "validate_query",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateAnalyticsQueryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsQueryResultResponse"
                }
              }
            },
            "description": "Dry-run analytics SQL result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "SQL failed analytics validation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Readonly analytics execution is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ],
        "x-idempotency-debt-id": "POST /api/v1/analytics/saved-queries/validate",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/analytics/saved-queries/{query_id}": {
      "delete": {
        "operationId": "delete_saved_query",
        "parameters": [
          {
            "description": "Saved analytics query id",
            "in": "path",
            "name": "query_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteSavedQueryResponse"
                }
              }
            },
            "description": "Saved analytics query deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Query not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/analytics/saved-queries/{query_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "patch": {
        "operationId": "patch_saved_query",
        "parameters": [
          {
            "description": "Saved analytics query id",
            "in": "path",
            "name": "query_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchSavedQueryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedAnalyticsQueryResponse"
                }
              }
            },
            "description": "Saved analytics query updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Updated SQL failed analytics validation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Query not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Readonly analytics execution is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/analytics/saved-queries/{query_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/analytics/saved-queries/{query_id}/edit-nl": {
      "post": {
        "operationId": "edit_saved_query_from_nl",
        "parameters": [
          {
            "description": "Saved analytics query id",
            "in": "path",
            "name": "query_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditSavedQueryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedAnalyticsQueryResponse"
                }
              }
            },
            "description": "Saved analytics query edited from natural language",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Instruction is missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Query not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Report edit did not produce a usable SQL/chart result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Analytics runtime or repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Analytics ask or readonly execution is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ],
        "x-idempotency-debt-id": "POST /api/v1/analytics/saved-queries/{query_id}/edit-nl",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/analytics/saved-queries/{query_id}/refresh": {
      "post": {
        "operationId": "refresh_saved_query",
        "parameters": [
          {
            "description": "Saved analytics query id",
            "in": "path",
            "name": "query_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedAnalyticsQueryResponse"
                }
              }
            },
            "description": "Saved analytics query refreshed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Saved query failed analytics validation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Query not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Readonly analytics execution is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ],
        "x-idempotency-debt-id": "POST /api/v1/analytics/saved-queries/{query_id}/refresh",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/audit-log": {
      "get": {
        "operationId": "list",
        "parameters": [
          {
            "in": "query",
            "name": "event_type",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "entity_type",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "entity_id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "actor_type",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "hash_state",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditLogListResponse"
                }
              }
            },
            "description": "Company audit log events",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid audit log query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "audit-log"
        ]
      }
    },
    "/api/v1/audit-log/verify-chain": {
      "get": {
        "operationId": "verify_chain",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChainVerificationResponse"
                }
              }
            },
            "description": "Audit hash chain prefix verification result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "audit-log"
        ]
      }
    },
    "/api/v1/auth/webhooks/clerk": {
      "post": {
        "operationId": "clerk",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "string"
              }
            }
          },
          "description": "Raw Svix-signed Clerk webhook payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClerkWebhookResponse"
                }
              }
            },
            "description": "Webhook acknowledged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid webhook payload or signature",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Clerk webhook signing secret is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "auth"
        ],
        "x-idempotency-deduplication": "The handler must deduplicate using provider event identity, callback state, or stored webhook receipt state.",
        "x-idempotency-explanation": "Ingress endpoint; replay safety is owned by the provider/webhook-specific durable handler.",
        "x-idempotency-policy": "external_ingress"
      }
    },
    "/api/v1/automations": {
      "get": {
        "operationId": "list",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationListResponse"
                }
              }
            },
            "description": "Company automation package metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "automations"
        ]
      }
    },
    "/api/v1/automations/import": {
      "post": {
        "operationId": "import",
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationDetailResponse"
                }
              }
            },
            "description": "Automation imported",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid multipart import upload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation package is too large",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid automation import upload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or storage configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Could not store automation files",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "automations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/automations/import",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/automations/runs/{run_id}": {
      "patch": {
        "operationId": "update_run",
        "parameters": [
          {
            "description": "Automation run UUID",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationRunUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunResponse"
                }
              }
            },
            "description": "Automation run updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid automation run update",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "automations"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/automations/runs/{run_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/automations/runs/{run_id}/events": {
      "post": {
        "operationId": "create_run_event",
        "parameters": [
          {
            "description": "Automation run UUID",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationRunEventCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunEventResponse"
                }
              }
            },
            "description": "Automation run event created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid automation run event",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "automations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/automations/runs/{run_id}/events",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/automations/runs/{run_id}/stage-proposal": {
      "post": {
        "operationId": "stage_run_proposal",
        "parameters": [
          {
            "description": "Automation run UUID",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationProposalStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationProposalStageResponse"
                }
              }
            },
            "description": "Automation proposal staged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid proposal source-document reference",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation run cannot stage proposals",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid automation proposal",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or storage error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "automations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/automations/runs/{run_id}/stage-proposal",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/automations/{automation_id}": {
      "delete": {
        "operationId": "delete",
        "parameters": [
          {
            "description": "Automation UUID",
            "in": "path",
            "name": "automation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Automation archived",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "automations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/automations/{automation_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "get": {
        "operationId": "get",
        "parameters": [
          {
            "description": "Automation UUID",
            "in": "path",
            "name": "automation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationDetailResponse"
                }
              }
            },
            "description": "Company automation package detail",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "automations"
        ]
      }
    },
    "/api/v1/automations/{automation_id}/files/{file_id}/download": {
      "get": {
        "operationId": "download_file",
        "parameters": [
          {
            "description": "Automation UUID",
            "in": "path",
            "name": "automation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Automation file UUID",
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationFileDownloadResponse"
                }
              }
            },
            "description": "Presigned automation file download URL",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation or file not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or storage configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Could not create automation file URL",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "automations"
        ]
      }
    },
    "/api/v1/automations/{automation_id}/runs": {
      "post": {
        "operationId": "create_run",
        "parameters": [
          {
            "description": "Automation UUID",
            "in": "path",
            "name": "automation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutomationRunCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunResponse"
                }
              }
            },
            "description": "Automation run created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid automation run request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation or version not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "automations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/automations/{automation_id}/runs",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/automations/{automation_id}/versions": {
      "post": {
        "operationId": "create_version",
        "parameters": [
          {
            "description": "Automation UUID",
            "in": "path",
            "name": "automation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationDetailResponse"
                }
              }
            },
            "description": "Automation version created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid multipart version upload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation has no version to update",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Automation package is too large",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid automation manifest or upload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or storage configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Could not store automation files",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "automations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/automations/{automation_id}/versions",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-matching/manual-match": {
      "post": {
        "operationId": "manual_match",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManualMatchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManualMatchResponse"
                }
              }
            },
            "description": "Manual bank transaction matches created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid document id",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No supplier invoice for document",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-matching"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-matching/manual-match",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-matching/matches": {
      "get": {
        "operationId": "list_matches",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_BankMatchingMatchResponse"
                }
              }
            },
            "description": "Bank transaction matches",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-matching"
        ]
      }
    },
    "/api/v1/bank-matching/matches/{match_id}": {
      "delete": {
        "operationId": "reject_match",
        "parameters": [
          {
            "description": "Bank transaction match id",
            "in": "path",
            "name": "match_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MatchDecisionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bank match rejected or staged for rejection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid match decision",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Match not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-matching"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/bank-matching/matches/{match_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-matching/matches/{match_id}/approve": {
      "post": {
        "operationId": "approve_match",
        "parameters": [
          {
            "description": "Bank transaction match id",
            "in": "path",
            "name": "match_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "bank_account",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MatchDecisionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bank match approved or staged for approval",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid match approval",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Match not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Match already approved",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-matching"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-matching/matches/{match_id}/approve",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-matching/payment-queue": {
      "get": {
        "operationId": "list_payment_queue",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "days_window",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierInvoicePaymentQueueListResponse"
                }
              }
            },
            "description": "Supplier invoice payment queue",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-matching"
        ]
      }
    },
    "/api/v1/bank-matching/receipt-approval": {
      "post": {
        "operationId": "approve_receipt_match",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReceiptApprovalRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptApprovalResponse"
                }
              }
            },
            "description": "Receipt bank transaction approved or staged for approval",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid receipt approval request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Receipt approval confirmation failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-matching"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-matching/receipt-approval",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-matching/receipt-candidates": {
      "post": {
        "operationId": "search_receipt_candidates",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReceiptCandidateSearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptCandidateResponse"
                }
              }
            },
            "description": "Deterministic receipt bank transaction candidates",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid receipt candidate request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-matching"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-matching/receipt-candidates",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-matching/receipt-confirmation": {
      "post": {
        "operationId": "confirm_receipt_candidates",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReceiptConfirmationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptConfirmationResponse"
                }
              }
            },
            "description": "Structured receipt bank match confirmation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid receipt confirmation request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Receipt confirmation failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-matching"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-matching/receipt-confirmation",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-matching/run": {
      "post": {
        "operationId": "run_bank_matching",
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankMatchingRunResponse"
                }
              }
            },
            "description": "Agentic bank matching workflow started",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Workflow API returned an invalid response",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Workflow API unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-matching"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-matching/run",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-matching/run-payment-matching": {
      "post": {
        "operationId": "run_payment_matching",
        "parameters": [
          {
            "in": "query",
            "name": "days_window",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiAcceptedWorkflow"
                }
              }
            },
            "description": "Supplier payment matching workflow started",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid supplier payment matching request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Workflow API returned an invalid response",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Workflow API unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-matching"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-matching/run-payment-matching",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-transactions/account": {
      "post": {
        "operationId": "account_transactions",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountBankTransactionsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiAcceptedWorkflow"
                }
              }
            },
            "description": "Bank transaction accounting workflow started",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid accounting batch request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Workflow API returned an invalid response",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Workflow API unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-transactions/account",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-transactions/accounts": {
      "get": {
        "operationId": "list_accounts",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionAccountListResponse"
                }
              }
            },
            "description": "Company bank accounts",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ]
      },
      "post": {
        "operationId": "create_account",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBankAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionAccountResponse"
                }
              }
            },
            "description": "Bank account created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid account mapping",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-transactions/accounts",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-transactions/accounts/{account_id}": {
      "delete": {
        "operationId": "delete_account",
        "parameters": [
          {
            "description": "Bank account id",
            "in": "path",
            "name": "account_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Bank account deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Account not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/bank-transactions/accounts/{account_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "patch": {
        "operationId": "update_account",
        "parameters": [
          {
            "description": "Bank account id",
            "in": "path",
            "name": "account_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchBankAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionAccountResponse"
                }
              }
            },
            "description": "Bank account updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid account mapping",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Account not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/bank-transactions/accounts/{account_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-transactions/import": {
      "post": {
        "operationId": "import_csv",
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionImportResultResponse"
                }
              }
            },
            "description": "Bank transaction CSV imported",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid import form",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Bank account not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Source account mapping required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "CSV parse error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-transactions/import",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-transactions/import/preview": {
      "post": {
        "operationId": "preview_import_csv",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionImportPreviewResponse"
                }
              }
            },
            "description": "Bank transaction CSV import preview",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid import preview form",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Bank account not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "CSV parse error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bank-transactions/import/preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-transactions/imports": {
      "get": {
        "operationId": "list_imports",
        "parameters": [
          {
            "in": "query",
            "name": "account_id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionImportListResponse"
                }
              }
            },
            "description": "Company bank transaction imports",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query parameter",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ]
      }
    },
    "/api/v1/bank-transactions/imports/{import_id}": {
      "delete": {
        "operationId": "delete_import",
        "parameters": [
          {
            "description": "Bank transaction import id",
            "in": "path",
            "name": "import_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Bank transaction import deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Import not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/bank-transactions/imports/{import_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-transactions/routing-rules": {
      "get": {
        "operationId": "list_routing_rules",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_BankAccountRoutingRuleResponse"
                }
              }
            },
            "description": "Company bank account routing rules",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ]
      }
    },
    "/api/v1/bank-transactions/routing-rules/{provider}/{source_account_key}": {
      "put": {
        "operationId": "upsert_routing_rule",
        "parameters": [
          {
            "description": "Source provider",
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Source account key",
            "in": "path",
            "name": "source_account_key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertRoutingRuleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionAccountResponse"
                }
              }
            },
            "description": "Routing rule upserted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid routing rule",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/bank-transactions/routing-rules/{provider}/{source_account_key}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bank-transactions/transactions": {
      "get": {
        "operationId": "list_transactions",
        "parameters": [
          {
            "in": "query",
            "name": "import_id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "account_id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "bank_name",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "reconciliation_status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "min_amount",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "max_amount",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "sort_by",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort_dir",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankTransactionListResponse"
                }
              }
            },
            "description": "Company bank transactions",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query parameter",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Import not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bank-transactions"
        ]
      }
    },
    "/api/v1/bookkeeping/intake-documents": {
      "get": {
        "operationId": "list_intake_documents",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentListOut"
                }
              }
            },
            "description": "Documents eligible for the Bookkeeping Inbox/Review",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid pagination",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bookkeeping"
        ]
      }
    },
    "/api/v1/bureau/docs": {
      "get": {
        "operationId": "list_bureau_documents",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_BureauDocumentResponse"
                }
              }
            },
            "description": "Bureau documentation pages",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller is not a bureau administrator",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bureau"
        ]
      },
      "post": {
        "operationId": "create_bureau_document",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BureauDocumentCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BureauDocumentResponse"
                }
              }
            },
            "description": "Bureau document created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller is not a bureau administrator",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid bureau document",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bureau"
        ],
        "x-idempotency-debt-id": "POST /api/v1/bureau/docs",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/bureau/docs/{id}": {
      "delete": {
        "operationId": "delete_bureau_document",
        "parameters": [
          {
            "description": "Bureau document id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiDeleted"
                }
              }
            },
            "description": "Bureau document deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller is not a bureau administrator",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Bureau document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bureau"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/bureau/docs/{id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "get": {
        "operationId": "get_bureau_document",
        "parameters": [
          {
            "description": "Bureau document id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BureauDocumentResponse"
                }
              }
            },
            "description": "Bureau document",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller is not a bureau administrator",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Bureau document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bureau"
        ]
      },
      "put": {
        "operationId": "update_bureau_document",
        "parameters": [
          {
            "description": "Bureau document id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BureauDocumentUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BureauDocumentResponse"
                }
              }
            },
            "description": "Updated bureau document",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller is not a bureau administrator",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Bureau document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid bureau document",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "bureau"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/bureau/docs/{id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/card-rules": {
      "get": {
        "operationId": "list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_CardRuleResponse"
                }
              }
            },
            "description": "Company card rules",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "card-rules"
        ]
      },
      "post": {
        "operationId": "create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardRuleCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CardRuleResponse"
                }
              }
            },
            "description": "Card rule created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid card rule request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Card rule already exists",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "card-rules"
        ],
        "x-idempotency-debt-id": "POST /api/v1/card-rules",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/card-rules/{rule_id}": {
      "delete": {
        "operationId": "delete",
        "parameters": [
          {
            "description": "Card rule UUID",
            "in": "path",
            "name": "rule_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Card rule deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid card rule request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Card rule not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "card-rules"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/card-rules/{rule_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "put": {
        "operationId": "update",
        "parameters": [
          {
            "description": "Card rule UUID",
            "in": "path",
            "name": "rule_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardRuleUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CardRuleResponse"
                }
              }
            },
            "description": "Card rule updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid card rule request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Card rule not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "card-rules"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/card-rules/{rule_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/chart-of-accounts": {
      "get": {
        "operationId": "list",
        "parameters": [
          {
            "in": "query",
            "name": "include_inactive",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "description": "Maximum number of objects to return.",
            "example": 25,
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int32",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Return objects after this cursor.",
            "in": "query",
            "name": "starting_after",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Return objects before this cursor.",
            "in": "query",
            "name": "ending_before",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Company tenant UUID selected by the Clerk-authenticated caller",
            "in": "header",
            "name": "X-Company-Id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional diagnostic request ID returned on the response",
            "in": "header",
            "name": "X-Request-Id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_ChartAccountResponse"
                }
              }
            },
            "description": "Effective company chart of accounts with BAS fallbacks",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid pagination query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "chart-of-accounts"
        ]
      },
      "post": {
        "operationId": "create",
        "parameters": [
          {
            "description": "Company tenant UUID selected by the Clerk-authenticated caller",
            "in": "header",
            "name": "X-Company-Id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Client-generated retry key for this mutating request",
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional diagnostic request ID returned on the response",
            "in": "header",
            "name": "X-Request-Id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateChartAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChartAccountResponse"
                }
              }
            },
            "description": "Chart account created",
            "headers": {
              "Idempotent-Replayed": {
                "description": "Present and true when this response is an idempotency replay",
                "schema": {
                  "type": "boolean"
                }
              },
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid account request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Account already exists or idempotency key is already in flight",
            "headers": {
              "Retry-After": {
                "description": "Present when error.code is idempotency_key_in_use",
                "schema": {
                  "type": "string"
                }
              },
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Idempotency key payload mismatch",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Idempotency storage unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "chart-of-accounts"
        ],
        "x-idempotency-policy": "required"
      }
    },
    "/api/v1/chart-of-accounts/{account_number}": {
      "delete": {
        "operationId": "deactivate",
        "parameters": [
          {
            "description": "BAS account number",
            "in": "path",
            "name": "account_number",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Company tenant UUID selected by the Clerk-authenticated caller",
            "in": "header",
            "name": "X-Company-Id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional diagnostic request ID returned on the response",
            "in": "header",
            "name": "X-Request-Id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Company account deactivated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid account number",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company account not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "chart-of-accounts"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/chart-of-accounts/{account_number}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "patch": {
        "operationId": "patch",
        "parameters": [
          {
            "description": "BAS account number",
            "in": "path",
            "name": "account_number",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Company tenant UUID selected by the Clerk-authenticated caller",
            "in": "header",
            "name": "X-Company-Id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional diagnostic request ID returned on the response",
            "in": "header",
            "name": "X-Request-Id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {}
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChartAccountResponse"
                }
              }
            },
            "description": "Chart account updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid account request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Account not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "chart-of-accounts"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/chart-of-accounts/{account_number}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/accounting-entries/create/stage": {
      "post": {
        "operationId": "stage_accounting_entry_create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliAccountingEntryCreateStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "CLI accounting create staged and imported into Review",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid accounting entry create payload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Bank transaction or staged operation state conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/accounting-entries/create/stage`. Imports a CLI-created\naccounting entry into Review as a draft and stages its later post action.",
        "tags": [
          "cli-accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/accounting-entries/create/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/accounting-entries/memo": {
      "post": {
        "operationId": "create_accounting_memo",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliAccountingMemoRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Manual accounting memo created or replayed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid accounting memo payload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Memo entry state conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/accounting-entries/memo`. Creates a manual memo entry with\ndeterministic memo-hash idempotency and optional generated PDF evidence.",
        "tags": [
          "cli-accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/accounting-entries/memo",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/accounting-entries/{entry_id}/discard": {
      "post": {
        "operationId": "discard_accounting_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Draft accounting entry discarded",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Accounting entry not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Entry cannot be discarded",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/accounting-entries/{entry_id}/discard`. Deletes a never-posted\ndraft and rejects pending staged operations that target it.",
        "tags": [
          "cli-accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/accounting-entries/{entry_id}/discard",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/accounting-entries/{entry_id}/update/stage": {
      "post": {
        "operationId": "stage_accounting_entry_update",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliAccountingEntryUpdateStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "CLI accounting update staged and imported into Review",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid accounting entry update payload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Accounting entry not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Draft, bank transaction, or staged operation state conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/accounting-entries/{entry_id}/update/stage`. Stages,\napproves, and applies a CLI patch to an existing Review draft.",
        "tags": [
          "cli-accounting-entries"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/accounting-entries/{entry_id}/update/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/accounting-hub/customers": {
      "get": {
        "operationId": "list_cli_customers",
        "parameters": [
          {
            "description": "Maximum number of rows to return (1\u20131000; defaults to the service cap).",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ledger-authoritative customer receivables in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-accounting-hub"
        ]
      }
    },
    "/api/v1/cli/accounting-hub/customers/import": {
      "post": {
        "operationId": "import_cli_customers",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliRegisterImportRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Register import preview/result in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid CSV or mapping",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-accounting-hub"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/accounting-hub/customers/import",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/accounting-hub/suppliers": {
      "get": {
        "operationId": "list_cli_suppliers",
        "parameters": [
          {
            "description": "Maximum number of rows to return (1\u20131000; defaults to the service cap).",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ledger-authoritative supplier payables in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-accounting-hub"
        ]
      }
    },
    "/api/v1/cli/accounting-hub/suppliers/import": {
      "post": {
        "operationId": "import_cli_suppliers",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliRegisterImportRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Register import preview/result in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid CSV or mapping",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-accounting-hub"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/accounting-hub/suppliers/import",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/audit/bundle": {
      "get": {
        "operationId": "get_audit_bundle",
        "parameters": [
          {
            "in": "query",
            "name": "document_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "entry_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "max_text_chars",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Audit evidence bundle wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "No document_id or entry_id supplied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Ledger entry not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/audit/bundle`. Returns the document/entry evidence bundle used\nby `igdrasil-cli audit bundle`.",
        "tags": [
          "cli-audit"
        ]
      }
    },
    "/api/v1/cli/bank-accounts": {
      "get": {
        "operationId": "list_bank_accounts",
        "parameters": [
          {
            "description": "Filter to accounts with this `source_provider` (e.g.\n`\"enable_banking\"`, `\"csv\"`, or `\"manual\"`). When absent,\nall accounts for the company are returned.",
            "in": "query",
            "name": "source_provider",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of bank accounts wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bank-accounts`. Lists every bank account for the company,\noptionally filtered by `source_provider`. Emits the\n`bank_account.ledger_mapping_missing` warning when one or more\naccounts lack a `ledger_account_number`.",
        "tags": [
          "cli-bank"
        ]
      }
    },
    "/api/v1/cli/bank-matches/candidates": {
      "get": {
        "operationId": "find_bank_match_candidates",
        "parameters": [
          {
            "in": "query",
            "name": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "reconciliation_status",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ledger_status",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "bank_account_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "scan_limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "max_days",
            "required": false,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Defaults to `0.05`. Parsing a Decimal from a query string needs the\n`serde_with` round-trip; we accept it as a String here and parse in the\nhandler so the default works without extra serde plumbing.",
            "in": "query",
            "name": "tolerance",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "min_score",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "include_linked_entries",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Scored candidate matches wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bank-matches/candidates`. Deterministic scoring (no\nLLM): for each scanned bank tx, find ledger entries whose\nmatching line is within `tolerance` and `max_days` of the bank\namount/date, score the pair, and return the top `limit` after\n`min_score` filtering.",
        "tags": [
          "cli-bank"
        ]
      }
    },
    "/api/v1/cli/bank-matches/doctor": {
      "get": {
        "operationId": "diagnose_bank_matches",
        "parameters": [
          {
            "in": "query",
            "name": "bank_account_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "divergence_only",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "examples_per_category",
            "required": false,
            "schema": {
              "minimum": 0,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bank-match doctor report wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bank-matches/doctor`. Company-level bank-link drift and cash-leg\nmismatch diagnostics.",
        "tags": [
          "cli-bank"
        ]
      }
    },
    "/api/v1/cli/bank-matches/ledger-link-plan": {
      "get": {
        "operationId": "plan_ledger_bank_links",
        "parameters": [
          {
            "in": "query",
            "name": "bank_query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "ledger_query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "bank_from",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "bank_to",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "ledger_from",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "ledger_to",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "amount",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "bank_account_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "ledger_status",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tolerance",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "max_days",
            "required": false,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "FIFO ledger-bank repair plan + verdict wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid plan scope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bank-matches/ledger-link-plan`. Builds the deterministic FIFO\nrepair plan (read-only) and returns it with an `ok`/`needs_repair`/`blocked`\nverdict. This is the single FIFO-coverage read: it merges what were formerly\nthe separate `ledger-link-plan` and `ledger-link-audit` routes.",
        "tags": [
          "cli-bank"
        ]
      }
    },
    "/api/v1/cli/bank-matches/ledger-link-repair/stage": {
      "post": {
        "operationId": "stage_ledger_bank_link_repair",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LedgerLinkRepairStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "FIFO ledger-bank link repair staged or reported as blocked/noop",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid repair scope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Staged operation state conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/bank-matches/ledger-link-repair/stage`. Builds the FIFO\nrepair plan and stages the planned link/move actions for review.",
        "tags": [
          "cli-bank"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/bank-matches/ledger-link-repair/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/bank-matches/reconcile/stage": {
      "post": {
        "operationId": "stage_bank_match_reconcile",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconcileStageBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bank reconcile stage result wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Normalisation rejected the request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "One or more referenced rows were not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/bank-matches/reconcile/stage`. Validates the local\n`igdrasil-cli` bank reconciliation stage contract in Rust and\ncreates a private staged operation when the input is valid.",
        "tags": [
          "cli-bank"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/bank-matches/reconcile/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/bank-matches/show": {
      "get": {
        "operationId": "show_bank_matches",
        "parameters": [
          {
            "in": "query",
            "name": "transaction_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "supplier_invoice_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "payment_entry_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bank match details wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "No subject filter supplied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bank-matches/show`. Detail read for match rows by bank\ntransaction, supplier invoice, or payment entry. The response embeds the\nbank transaction summary on each item.",
        "tags": [
          "cli-bank"
        ]
      }
    },
    "/api/v1/cli/bank-matches/summary": {
      "get": {
        "operationId": "summarize_bank_matches",
        "parameters": [
          {
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bank matches summary wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bank-matches/summary`. Per-(company, account, status)\naggregation of bank transactions plus a count of\n`bank_transaction_matches` rows. Read-only \u2014 heavy GROUP BY but\nno writes.",
        "tags": [
          "cli-bank"
        ]
      }
    },
    "/api/v1/cli/bank-transactions/by-prefix/{prefix}": {
      "get": {
        "operationId": "resolve_bank_transaction_prefix",
        "parameters": [
          {
            "description": "Bank transaction UUID prefix, minimum 8 characters",
            "in": "path",
            "name": "prefix",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Single bank transaction prefix match wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid prefix",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No matching bank transaction",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Prefix matches multiple bank transactions",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bank-transactions/by-prefix/{prefix}`. Resolves the short id printed by search.",
        "tags": [
          "cli-bank"
        ]
      }
    },
    "/api/v1/cli/bank-transactions/search": {
      "get": {
        "operationId": "search_bank_transactions",
        "parameters": [
          {
            "description": "Free-text query: matches any of `description`, `counterparty`,\n`payment_reference` via ILIKE. Whitespace is collapsed and\nempty \u2192 no filter.",
            "in": "query",
            "name": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "reconciliation_status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Alias accepted for operator ergonomics. `reconciliation_status` wins\nwhen both are supplied.",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "amount",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "amount_min",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "amount_max",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "abs_amount",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "currency",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "0-based offset. Clamped to >= 0 at the route layer.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Page size. Clamped to 1..=500 at the route layer.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated bank transactions wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid search filter",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bank-transactions/search`. Paginated, filterable list of\nbank transactions with the contract filter and summary fields.",
        "tags": [
          "cli-bank"
        ]
      }
    },
    "/api/v1/cli/bank-transactions/{transaction_id}": {
      "get": {
        "operationId": "show_bank_transaction",
        "parameters": [
          {
            "in": "query",
            "name": "with",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "transaction_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bank transaction detail wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Bank transaction not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bank-transactions/{transaction_id}`. Detail read for one bank\ntransaction, optionally carrying the same match payloads returned when\n`with=matches`.",
        "tags": [
          "cli-bank"
        ]
      }
    },
    "/api/v1/cli/bookkeeping/inbox/duplicates": {
      "get": {
        "operationId": "list_bookkeeping_inbox_duplicates",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "with",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bookkeeping Inbox duplicate groups wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid filter or limit",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bookkeeping/inbox/duplicates`. Returns the canonical\nBookkeeping Inbox duplicate overview for CLI/agent use.",
        "tags": [
          "cli-bookkeeping"
        ]
      }
    },
    "/api/v1/cli/bookkeeping/inbox/items": {
      "get": {
        "operationId": "list_bookkeeping_inbox_items",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "with",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bookkeeping Inbox items wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid filter or pagination",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/bookkeeping/inbox/items`. Returns the canonical Bookkeeping Inbox\nread model for CLI/agent use.",
        "tags": [
          "cli-bookkeeping"
        ]
      }
    },
    "/api/v1/cli/chart-of-accounts": {
      "get": {
        "operationId": "list_chart_of_accounts",
        "parameters": [
          {
            "in": "query",
            "name": "include_inactive",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "missing_name_only",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Chart of accounts wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid chart query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-chart-of-accounts"
        ]
      },
      "post": {
        "operationId": "create_chart_account",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateChartAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Created chart account wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid chart account request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Chart account already exists",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-chart-of-accounts"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/chart-of-accounts",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/chart-of-accounts/{account_number}": {
      "patch": {
        "operationId": "rename_chart_account",
        "parameters": [
          {
            "description": "BAS account number",
            "in": "path",
            "name": "account_number",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliChartAccountRenameRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Renamed chart account wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid chart account request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Chart account not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-chart-of-accounts"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/cli/chart-of-accounts/{account_number}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/contracts": {
      "get": {
        "operationId": "get_cli_contracts",
        "responses": {
          "200": {
            "description": "Agent capability contracts derived from the public CLI schema",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/contracts`. Builds the agent capability registry from the same\nlocal CLI schema using the Rust-owned `agent-kernel-core` derivation rules.",
        "tags": [
          "cli-schema"
        ]
      }
    },
    "/api/v1/cli/documents/{document_id}/extract": {
      "post": {
        "operationId": "extract_document_for_cli",
        "parameters": [
          {
            "description": "Document id to extract",
            "in": "path",
            "name": "document_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "stages",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document extraction workflow started in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid stage list",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Document processing service unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/documents/{document_id}/extract`. Starts the Temporal-backed\ndocument extraction workflow and returns the existing CLI envelope.",
        "tags": [
          "cli-documents"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/documents/{document_id}/extract",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/find": {
      "get": {
        "operationId": "find_cli_objects",
        "parameters": [
          {
            "in": "query",
            "name": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "types",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CLI find results wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid query or pagination",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/find`. Returns the cross-domain CLI search result list.",
        "tags": [
          "cli-find"
        ]
      }
    },
    "/api/v1/cli/fx/convert": {
      "get": {
        "operationId": "convert_fx",
        "parameters": [
          {
            "in": "query",
            "name": "amount",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "currency",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "FX conversion wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid currency or query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "No Riksbanken rate found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Riksbanken API key is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/fx/convert`. Converts a foreign-currency amount to SEK.",
        "tags": [
          "cli-fx"
        ]
      }
    },
    "/api/v1/cli/inbox/inspect/{subject_id}": {
      "get": {
        "operationId": "inspect_inbox_item",
        "parameters": [
          {
            "description": "Document or ledger entry id to inspect",
            "in": "path",
            "name": "subject_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "with",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "max_text_chars",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inbox inspection wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid include or text limit",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Document or ledger entry not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/inbox/inspect/{subject_id}`. Returns the review graph for a\ndocument or ledger entry in the CLI inbox workflow.",
        "tags": [
          "cli-inbox"
        ]
      }
    },
    "/api/v1/cli/inbox/items": {
      "get": {
        "operationId": "list_inbox_items",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "with",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inbox items wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid filter or pagination",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/inbox/items`. Returns the generic CLI document inbox list.",
        "tags": [
          "cli-inbox"
        ]
      }
    },
    "/api/v1/cli/inbox/post-ready": {
      "post": {
        "operationId": "post_ready_inbox_items",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "export_external",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "apply",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ready inbox entries dry-run or posted in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid status, limit, or posting request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Staged operation or ledger state conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/inbox/post-ready`. Dry-runs or posts ready draft entries linked\nfrom the CLI document inbox.",
        "tags": [
          "cli-inbox"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/inbox/post-ready",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/inbox/{document_id}/delete": {
      "post": {
        "operationId": "delete_inbox_item",
        "parameters": [
          {
            "description": "Inbox document id to delete",
            "in": "path",
            "name": "document_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "apply",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inbox delete dry-run or result wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Inbox document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/inbox/{document_id}/delete`. Dry-runs or deletes an inbox\ndocument and its linked draft accounting artifacts.",
        "tags": [
          "cli-inbox"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/inbox/{document_id}/delete",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/inspect/{subject}": {
      "get": {
        "operationId": "inspect_cli_subject",
        "parameters": [
          {
            "description": "UUID subject id or free-text query",
            "in": "path",
            "name": "subject",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "with",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "max_text_chars",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CLI inspection wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid text limit",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "No inspectable object found for the UUID",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/inspect/{subject}`. Resolves a CLI subject id or query.",
        "tags": [
          "cli-inspect"
        ]
      }
    },
    "/api/v1/cli/ledger/accounts/{account_number}": {
      "get": {
        "operationId": "account_ledger",
        "parameters": [
          {
            "description": "BAS account number",
            "in": "path",
            "name": "account_number",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "live",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Account ledger wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid account ledger query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/ledger/accounts/{account_number}`. Shows one BAS account ledger.",
        "tags": [
          "cli-ledger"
        ]
      }
    },
    "/api/v1/cli/ledger/accounts/{account_number}/monthly": {
      "get": {
        "operationId": "account_monthly",
        "parameters": [
          {
            "description": "BAS account number",
            "in": "path",
            "name": "account_number",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "live",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monthly account series wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid account monthly query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/ledger/accounts/{account_number}/monthly`. Shows monthly account totals.",
        "tags": [
          "cli-ledger"
        ]
      }
    },
    "/api/v1/cli/ledger/bank-link-batch/stage": {
      "post": {
        "operationId": "stage_ledger_bank_link_batch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliLedgerBankLinkBatchStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged batch bank-link operation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid batch bank-link request (e.g. allocations do not sum to the bank row)",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Bank transaction or ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Bank transaction cannot be linked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/ledger/bank-link-batch/stage`. Stages linking ONE bank row to\nMANY ledger entries with explicit per-entry allocation amounts (e.g. one\npayroll bank payment covering several employee vouchers). The allocation\namounts must sum to the bank row amount.",
        "tags": [
          "cli-ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/ledger/bank-link-batch/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/ledger/currency-audit": {
      "get": {
        "operationId": "currency_audit",
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Currency audit wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid pagination",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/ledger/currency-audit`. Audits multi-currency ledger safety.",
        "tags": [
          "cli-ledger"
        ]
      }
    },
    "/api/v1/cli/ledger/entries": {
      "get": {
        "operationId": "list_ledger_entries",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "account_number",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Free-text filter matched (case-insensitive) against the entry\ndescription, llm_description, source_text, customer name, invoice number,\npayment reference, and entry_context.",
            "in": "query",
            "name": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "live",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ledger entry summaries wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid pagination",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/ledger/entries`. Lists ledger entries in the CLI envelope.",
        "tags": [
          "cli-ledger"
        ]
      }
    },
    "/api/v1/cli/ledger/entries/by-prefix/{prefix}": {
      "get": {
        "operationId": "resolve_ledger_entry_prefix",
        "parameters": [
          {
            "description": "Ledger entry UUID prefix, minimum 8 characters",
            "in": "path",
            "name": "prefix",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Single ledger entry prefix match wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid prefix",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No matching ledger entry",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Prefix matches multiple ledger entries",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/ledger/entries/by-prefix/{prefix}`. Resolves the short id printed by `ledger list`.",
        "tags": [
          "cli-ledger"
        ]
      }
    },
    "/api/v1/cli/ledger/entries/post/bulk": {
      "post": {
        "operationId": "bulk_post_ledger_entries",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliLedgerPostBulkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bulk ledger post status wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid bulk post request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/ledger/entries/post/bulk`. Stages or applies multiple ledger\npost operations in the CLI envelope.",
        "tags": [
          "cli-ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/ledger/entries/post/bulk",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/ledger/entries/{entry_id}": {
      "get": {
        "operationId": "show_ledger_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "raw",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "with",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Max characters of source-document extracted text to include per document\nwhen `with=source-documents`. Defaults to 4000; 0 omits the text body.",
            "in": "query",
            "name": "max_text_chars",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ledger entry details or raw entry serialization",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/ledger/entries/{entry_id}`. Shows one ledger entry.",
        "tags": [
          "cli-ledger"
        ]
      }
    },
    "/api/v1/cli/ledger/entries/{entry_id}/bank-link/stage": {
      "post": {
        "operationId": "stage_ledger_bank_link",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliLedgerBankLinkStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged ledger bank-link operation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid bank-link staging request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Bank transaction cannot be linked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/ledger/entries/{entry_id}/bank-link/stage`. Stages bank rows\nto be linked to a ledger entry.",
        "tags": [
          "cli-ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/ledger/entries/{entry_id}/bank-link/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/ledger/entries/{entry_id}/bank-unlink/stage": {
      "post": {
        "operationId": "stage_ledger_bank_unlink",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliLedgerBankLinkStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged ledger bank-unlink operation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid bank-unlink staging request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/ledger/entries/{entry_id}/bank-unlink/stage`. Stages bank rows\nto be unlinked from a ledger entry.",
        "tags": [
          "cli-ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/ledger/entries/{entry_id}/bank-unlink/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/ledger/entries/{entry_id}/check": {
      "get": {
        "operationId": "check_ledger_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Posting readiness wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/ledger/entries/{entry_id}/check`. Checks posting readiness.",
        "tags": [
          "cli-ledger"
        ]
      }
    },
    "/api/v1/cli/ledger/entries/{entry_id}/correct/stage": {
      "post": {
        "operationId": "stage_ledger_correct",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliLedgerCorrectStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged ledger correction operation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Entry cannot be corrected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Correction requires replacement lines",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/ledger/entries/{entry_id}/correct/stage`. Stages a ledger\ncorrection operation for later approval and apply.",
        "tags": [
          "cli-ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/ledger/entries/{entry_id}/correct/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/ledger/entries/{entry_id}/post/stage": {
      "post": {
        "operationId": "stage_ledger_post",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "export_external",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Staged ledger post operation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/ledger/entries/{entry_id}/post/stage`. Stages one ledger\npost operation for later approval and apply.",
        "tags": [
          "cli-ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/ledger/entries/{entry_id}/post/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/ledger/entries/{entry_id}/reverse/stage": {
      "post": {
        "operationId": "stage_ledger_reverse",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "reversal_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "description",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Staged ledger reversal operation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Entry cannot be reversed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/ledger/entries/{entry_id}/reverse/stage`. Stages a ledger\nreversal operation for later approval and apply.",
        "tags": [
          "cli-ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/ledger/entries/{entry_id}/reverse/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/reconcile/bank-account": {
      "get": {
        "operationId": "reconcile_bank_account",
        "parameters": [
          {
            "in": "query",
            "name": "account",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "from_date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "examples_per_category",
            "required": false,
            "schema": {
              "minimum": 0,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bank-account reconciliation report wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid account/date request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Mapped bank account not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Mapped BAS account is ambiguous",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/reconcile/bank-account`. Per-bank-account reconciliation\ndiagnostic with category coverage.",
        "tags": [
          "cli-bank"
        ]
      }
    },
    "/api/v1/cli/reports/accruals": {
      "get": {
        "operationId": "show_accruals",
        "parameters": [
          {
            "in": "query",
            "name": "fiscal_period_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Accrual metadata wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/reports/accruals`. Shows first-class accrual metadata.",
        "tags": [
          "cli-reports"
        ]
      }
    },
    "/api/v1/cli/reports/accruals/preview": {
      "post": {
        "operationId": "preview_accruals",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccrualPreviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Accrual preview wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid accrual preview request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/reports/accruals/preview`. Builds read-only accrual proposals.",
        "tags": [
          "cli-reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/reports/accruals/preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/reports/accruals/reverse-due/stage": {
      "post": {
        "operationId": "stage_reverse_due_accruals",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccrualReverseDueStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged due-accrual reversal operation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid due-accrual reversal request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Accrual reversal staging transition conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/reports/accruals/reverse-due/stage`. Stages scheduled\naccrual reversals due on or before `as_of`.",
        "tags": [
          "cli-reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/reports/accruals/reverse-due/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/reports/accruals/stage": {
      "post": {
        "operationId": "stage_accruals",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccrualStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged accrual posting operation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid accrual stage request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Accrual staging transition conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/reports/accruals/stage`. Stages accrual posting proposals\nfor approval without posting ledger entries.",
        "tags": [
          "cli-reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/reports/accruals/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/reports/accruals/verify": {
      "get": {
        "operationId": "verify_accruals",
        "parameters": [
          {
            "in": "query",
            "name": "operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Accrual staged-operation verification wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Staged operation not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/reports/accruals/verify`. Verifies an accrual staged operation.",
        "tags": [
          "cli-reports"
        ]
      }
    },
    "/api/v1/cli/reports/fixed-assets": {
      "get": {
        "operationId": "show_fixed_assets",
        "parameters": [
          {
            "description": "Optional register status filter (`draft`/`active`/`disposed`/\u2026).",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Fixed-asset register wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/reports/fixed-assets`. Lists anl\u00e4ggningsregister rows.",
        "tags": [
          "cli-reports"
        ]
      }
    },
    "/api/v1/cli/reports/fixed-assets/detail": {
      "get": {
        "operationId": "show_fixed_asset_detail",
        "parameters": [
          {
            "in": "query",
            "name": "asset_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Fixed-asset detail wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Fixed asset not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/reports/fixed-assets/detail`. One asset with its schedule and events.",
        "tags": [
          "cli-reports"
        ]
      }
    },
    "/api/v1/cli/reports/fixed-assets/jamkning/preview": {
      "post": {
        "operationId": "preview_fixed_asset_jamkning",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetJamkningPreviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "VAT j\u00e4mkning preview wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid j\u00e4mkning preview request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/reports/fixed-assets/jamkning/preview`. VAT j\u00e4mkning adjustment (item 2).",
        "tags": [
          "cli-reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/reports/fixed-assets/jamkning/preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/reports/fixed-assets/tax/preview": {
      "post": {
        "operationId": "preview_fixed_asset_tax",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetTaxPreviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Tax-depreciation schedule wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid tax preview request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Fixed asset not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/reports/fixed-assets/tax/preview`. Tax-depreciation schedule (item 4).",
        "tags": [
          "cli-reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/reports/fixed-assets/tax/preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/reports/system-documentation": {
      "get": {
        "operationId": "system_documentation",
        "parameters": [
          {
            "in": "query",
            "name": "fiscal_period_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "System documentation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Fiscal period not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/reports/system-documentation`. Shows voucher-series registry and verification-chain documentation.",
        "tags": [
          "cli-reports"
        ]
      }
    },
    "/api/v1/cli/review/audit": {
      "get": {
        "operationId": "audit_review_items",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "max_text_chars",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "full",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Review audit rows wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid status or bounds",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/review/audit`. Batch-audits review/inbox rows.",
        "tags": [
          "cli-review"
        ]
      }
    },
    "/api/v1/cli/review/show/{subject_id}": {
      "get": {
        "operationId": "show_review_subject",
        "parameters": [
          {
            "description": "Review subject UUID",
            "in": "path",
            "name": "subject_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "with",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "max_text_chars",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Review subject inspection wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid text limit",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "No inspectable object found for the UUID",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/review/show/{subject_id}`. Returns review-stage inspection.",
        "tags": [
          "cli-review"
        ]
      }
    },
    "/api/v1/cli/schema": {
      "get": {
        "operationId": "get_cli_schema",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliSchemaResponse"
                }
              }
            },
            "description": "Public igdrasil-cli schema",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/schema` intentionally requires only user auth, not\n`X-Company-Id`.",
        "tags": [
          "cli-schema"
        ]
      }
    },
    "/api/v1/cli/sie/exports": {
      "get": {
        "operationId": "list_sie_exports",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieExportArtifactListResponse"
                }
              }
            },
            "description": "Retained SIE export artifacts",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-sie"
        ]
      }
    },
    "/api/v1/cli/sie/exports/{artifact_id}": {
      "get": {
        "operationId": "show_sie_export",
        "parameters": [
          {
            "description": "SIE export artifact id",
            "in": "path",
            "name": "artifact_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieExportArtifactSummary"
                }
              }
            },
            "description": "SIE export artifact metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Export artifact not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-sie"
        ]
      }
    },
    "/api/v1/cli/sie/imports": {
      "get": {
        "operationId": "list_sie_import_plans",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieImportPlanListResponse"
                }
              }
            },
            "description": "SIE import-plan summaries",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-sie"
        ]
      }
    },
    "/api/v1/cli/sie/imports/preview": {
      "post": {
        "operationId": "preview_sie_import_plan",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieImportPreviewResponse"
                }
              }
            },
            "description": "SIE import preview staged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid SIE upload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-sie"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/sie/imports/preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/sie/imports/{operation_id}": {
      "get": {
        "operationId": "show_sie_import_plan",
        "parameters": [
          {
            "description": "Staged SIE import-plan UUID",
            "in": "path",
            "name": "operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieImportPlanDetailResponse"
                }
              }
            },
            "description": "SIE import-plan detail",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Import plan not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-sie"
        ]
      }
    },
    "/api/v1/cli/sie/imports/{operation_id}/apply": {
      "post": {
        "operationId": "apply_sie_import_plan",
        "parameters": [
          {
            "description": "Staged SIE import-plan UUID",
            "in": "path",
            "name": "operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieImportApplyResponse"
                }
              }
            },
            "description": "SIE import plan applied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Import plan is blocked or invalid",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Import plan not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-sie"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/sie/imports/{operation_id}/apply",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/sie/imports/{operation_id}/artifact-metadata": {
      "get": {
        "operationId": "show_sie_import_artifact_metadata",
        "parameters": [
          {
            "description": "Staged SIE import-plan UUID",
            "in": "path",
            "name": "operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieImportArtifactMetadataResponse"
                }
              }
            },
            "description": "SIE import artifact metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Import artifact not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-sie"
        ]
      }
    },
    "/api/v1/cli/staged-operations": {
      "get": {
        "operationId": "list_staged_operations",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "include_executed",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliStagedListEnvelope"
                }
              }
            },
            "description": "Staged-operation summaries wrapped in the CLI list envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid limit",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/staged-operations`. Lists staged-operation summaries for CLI use.",
        "tags": [
          "cli-staged-operations"
        ]
      }
    },
    "/api/v1/cli/staged-operations/preview": {
      "get": {
        "operationId": "preview_staged_operations",
        "parameters": [
          {
            "in": "query",
            "name": "account",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliStagedPreviewEnvelope"
                }
              }
            },
            "description": "Projected pending staged-operation effects",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/staged-operations/preview`. Returns projected pending staged-operation net effect.",
        "tags": [
          "cli-staged-operations"
        ]
      }
    },
    "/api/v1/cli/staged-operations/{operation_id}": {
      "get": {
        "operationId": "show_staged_operation",
        "parameters": [
          {
            "description": "Staged operation UUID",
            "in": "path",
            "name": "operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliStagedShowEnvelope"
                }
              }
            },
            "description": "Staged operation wrapped in the CLI show envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Staged operation not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/staged-operations/{operation_id}`. Returns one staged operation for CLI use.",
        "tags": [
          "cli-staged-operations"
        ]
      }
    },
    "/api/v1/cli/staged-operations/{operation_id}/apply": {
      "post": {
        "operationId": "apply_staged_operation",
        "parameters": [
          {
            "description": "Staged operation UUID",
            "in": "path",
            "name": "operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "note",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Applied staged operation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Staged operation not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Operation status cannot be applied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Operation family is not yet Rust-owned for CLI apply",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/staged-operations/{operation_id}/apply`. Applies a Rust-owned\nstaged operation for CLI use.",
        "tags": [
          "cli-staged-operations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/staged-operations/{operation_id}/apply",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/staged-operations/{operation_id}/reject": {
      "post": {
        "operationId": "reject_staged_operation",
        "parameters": [
          {
            "description": "Staged operation UUID",
            "in": "path",
            "name": "operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "note",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "discard_entry",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rejected staged operation wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Operation-specific rejection failed validation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Staged operation not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Completed operation cannot be rejected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Operation-specific rejection input is invalid",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/staged-operations/{operation_id}/reject`. Rejects a staged\noperation for CLI use.",
        "tags": [
          "cli-staged-operations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/staged-operations/{operation_id}/reject",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/supplier-invoices/{invoice_id}": {
      "get": {
        "operationId": "show_supplier_invoice",
        "parameters": [
          {
            "description": "Supplier invoice UUID or short id (>= 8 hex chars, as printed by list/search)",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Supplier invoice wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Ambiguous or malformed supplier invoice id/short id",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Supplier invoice not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/supplier-invoices/{invoice_id}`. Returns one supplier invoice.",
        "tags": [
          "cli-supplier-invoices"
        ]
      }
    },
    "/api/v1/cli/supplier-invoices/{invoice_id}/cancel/stage": {
      "post": {
        "operationId": "stage_supplier_invoice_cancel",
        "parameters": [
          {
            "description": "Supplier invoice UUID or short id (>= 8 hex chars, as printed by list/search)",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliSupplierInvoiceCancelStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Supplier invoice cancellation staging result wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid supplier invoice cancellation request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Supplier invoice not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Supplier invoice staging transition conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/supplier-invoices/{invoice_id}/cancel/stage`. Stages a supplier\ninvoice cancellation for approval.",
        "tags": [
          "cli-supplier-invoices"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/supplier-invoices/{invoice_id}/cancel/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/supplier-invoices/{invoice_id}/update/stage": {
      "post": {
        "operationId": "stage_supplier_invoice_update",
        "parameters": [
          {
            "description": "Supplier invoice UUID or short id (>= 8 hex chars, as printed by list/search)",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliSupplierInvoiceUpdateStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Supplier invoice update staging result wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid supplier invoice update patch",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Supplier invoice not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Supplier invoice staging transition conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /cli/supplier-invoices/{invoice_id}/update/stage`. Stages a\nsupplier invoice patch for approval.",
        "tags": [
          "cli-supplier-invoices"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/supplier-invoices/{invoice_id}/update/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/trial-balance": {
      "get": {
        "operationId": "trial_balance",
        "parameters": [
          {
            "in": "query",
            "name": "from_date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "to_date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "account",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "account_class",
            "required": false,
            "schema": {
              "format": "int32",
              "minimum": 0,
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "non_zero",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "live",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Trial balance wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid trial balance query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /cli/trial-balance`. Shows the CLI Saldobalans envelope.",
        "tags": [
          "cli-reports"
        ]
      }
    },
    "/api/v1/cli/voucher-series": {
      "get": {
        "operationId": "list_voucher_series",
        "parameters": [
          {
            "description": "Operate on a specific fiscal period instead of the one covering today.",
            "in": "query",
            "name": "fiscal_period_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Resolve the period covering this date (defaults to today).",
            "in": "query",
            "name": "as_of",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "List every configured fiscal period's series instead of one.",
            "in": "query",
            "name": "all_periods",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Voucher series wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-voucher-series"
        ]
      },
      "post": {
        "operationId": "create_voucher_series",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliVoucherSeriesCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Created series wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid series request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Series code already exists",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-voucher-series"
        ],
        "x-idempotency-debt-id": "POST /api/v1/cli/voucher-series",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/cli/voucher-series/{code}": {
      "patch": {
        "operationId": "update_voucher_series",
        "parameters": [
          {
            "description": "Voucher series code",
            "in": "path",
            "name": "code",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliVoucherSeriesUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated series wrapped in the CLI envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Invalid series request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Series not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliProblemDetails"
                }
              }
            },
            "description": "Series already has posted vouchers",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "cli-voucher-series"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/cli/voucher-series/{code}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/companies": {
      "get": {
        "operationId": "list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyListOut"
                }
              }
            },
            "description": "Companies the current user belongs to",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ]
      },
      "post": {
        "operationId": "create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCompanyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyOut"
                }
              }
            },
            "description": "Created company profile",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid company request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "A company with this organization number already exists",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ],
        "x-idempotency-debt-id": "POST /api/v1/companies",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/companies/invitations/mine": {
      "get": {
        "operationId": "list_my_invitations",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MyInvitationsOut"
                }
              }
            },
            "description": "Pending company invitations addressed to the current user",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ]
      }
    },
    "/api/v1/companies/invitations/{invitation_id}/accept": {
      "post": {
        "operationId": "accept_my_invitation",
        "parameters": [
          {
            "description": "Invitation id",
            "in": "path",
            "name": "invitation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyOut"
                }
              }
            },
            "description": "Accepted invitation company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Authenticated user has no valid email",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invitation not found for this user",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ],
        "x-idempotency-debt-id": "POST /api/v1/companies/invitations/{invitation_id}/accept",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/companies/{company_id}": {
      "delete": {
        "operationId": "delete",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Company deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company cannot be deleted while other members exist",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Only the company creator can delete it",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found or access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/companies/{company_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "get": {
        "operationId": "get",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyOut"
                }
              }
            },
            "description": "Company profile",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found or access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ]
      },
      "put": {
        "operationId": "update",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCompanyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated or staged company update",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid company update",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found or access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Version conflict or staging transition conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or staging error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/companies/{company_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/companies/{company_id}/invitations": {
      "post": {
        "operationId": "invite_member",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteCompanyMemberRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyInvitationOut"
                }
              }
            },
            "description": "Company invitation created or existing user added",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid invitation request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found or access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "User is already a company member",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or invite dependency error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invite email dependency unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ],
        "x-idempotency-debt-id": "POST /api/v1/companies/{company_id}/invitations",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/companies/{company_id}/invitations/{invitation_id}": {
      "delete": {
        "operationId": "revoke_invitation",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Invitation id",
            "in": "path",
            "name": "invitation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Invitation revoked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accepted invitations cannot be revoked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company or invitation not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/companies/{company_id}/invitations/{invitation_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/companies/{company_id}/invitations/{invitation_id}/resend": {
      "post": {
        "operationId": "resend_invitation",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Invitation id",
            "in": "path",
            "name": "invitation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyInvitationOut"
                }
              }
            },
            "description": "Company invitation resent",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accepted invitations cannot be resent",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company or invitation not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or invite dependency error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invite email dependency unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ],
        "x-idempotency-debt-id": "POST /api/v1/companies/{company_id}/invitations/{invitation_id}/resend",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/companies/{company_id}/mcp-key": {
      "delete": {
        "operationId": "revoke_mcp_key",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "MCP API key revoked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Only the company creator can manage MCP keys",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found or access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/companies/{company_id}/mcp-key",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "post": {
        "operationId": "generate_mcp_key",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "stage",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Generated or staged company MCP key",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid MCP key generation request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Only the company creator can manage MCP keys",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found or access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "MCP key or staging transition conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or staging error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ],
        "x-idempotency-debt-id": "POST /api/v1/companies/{company_id}/mcp-key",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/companies/{company_id}/mcp-key/status": {
      "get": {
        "operationId": "mcp_key_status",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpKeyStatusOut"
                }
              }
            },
            "description": "Whether the company has an MCP API key",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Only the company creator can manage MCP keys",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found or access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ]
      }
    },
    "/api/v1/companies/{company_id}/members/{member_user_id}": {
      "delete": {
        "operationId": "remove_member",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Member user id",
            "in": "path",
            "name": "member_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Company member removed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Member cannot be removed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company or member not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/companies/{company_id}/members/{member_user_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/companies/{company_id}/team": {
      "get": {
        "operationId": "team",
        "parameters": [
          {
            "description": "Company id",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyTeamOut"
                }
              }
            },
            "description": "Company members and pending invitations",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found or access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "companies"
        ]
      }
    },
    "/api/v1/customer-invoices": {
      "get": {
        "operationId": "list_customer_invoices",
        "parameters": [
          {
            "description": "Filter by invoice status",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by customer",
            "in": "query",
            "name": "customer_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Max rows (1..=500, default 100)",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_CustomerInvoiceResponse"
                }
              }
            },
            "description": "The company's customer invoices, newest first",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ]
      },
      "post": {
        "operationId": "create_customer_invoice",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerInvoiceCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerInvoiceMutationResponse"
                }
              }
            },
            "description": "Draft customer invoice created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid customer invoice draft request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ],
        "x-idempotency-debt-id": "POST /api/v1/customer-invoices",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/customer-invoices/next-number": {
      "get": {
        "operationId": "next_customer_invoice_number",
        "parameters": [
          {
            "description": "Invoice date (YYYY-MM-DD) the number-series year derives from; defaults to today",
            "in": "query",
            "name": "invoice_date",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NextInvoiceNumberResponse"
                }
              }
            },
            "description": "Predicted next invoice number and derived OCR reference (read-only, nothing allocated)",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ]
      }
    },
    "/api/v1/customer-invoices/{invoice_id}": {
      "get": {
        "operationId": "get_customer_invoice",
        "parameters": [
          {
            "description": "Customer invoice UUID",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerInvoiceOutResponse"
                }
              }
            },
            "description": "The customer invoice",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer invoice not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ]
      },
      "patch": {
        "operationId": "update_customer_invoice",
        "parameters": [
          {
            "description": "Customer invoice UUID",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerInvoiceUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerInvoiceMutationResponse"
                }
              }
            },
            "description": "Draft customer invoice updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer invoice not found or invalid draft update",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/customer-invoices/{invoice_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/customer-invoices/{invoice_id}/credit": {
      "post": {
        "operationId": "credit_customer_invoice",
        "parameters": [
          {
            "description": "Customer invoice UUID",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerInvoiceCreditRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Credit note created, previewed, or staged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer invoice cannot be credited",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Staged operation not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Staging transition conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or staging error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ],
        "x-idempotency-debt-id": "POST /api/v1/customer-invoices/{invoice_id}/credit",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/customer-invoices/{invoice_id}/deliveries": {
      "get": {
        "operationId": "list_customer_invoice_deliveries",
        "parameters": [
          {
            "description": "Customer invoice UUID",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_CustomerInvoiceDeliveryResponse"
                }
              }
            },
            "description": "The invoice's delivery attempts, newest first",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer invoice not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ]
      }
    },
    "/api/v1/customer-invoices/{invoice_id}/issue": {
      "post": {
        "operationId": "issue_customer_invoice",
        "parameters": [
          {
            "description": "Customer invoice UUID",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerInvoiceIssueRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Customer invoice issued, previewed, or staged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer invoice cannot be issued",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Staged operation not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Staging transition conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or staging error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ],
        "x-idempotency-debt-id": "POST /api/v1/customer-invoices/{invoice_id}/issue",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/customer-invoices/{invoice_id}/pdf": {
      "get": {
        "operationId": "download_customer_invoice_pdf",
        "parameters": [
          {
            "description": "Customer invoice UUID",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The customer invoice as a PDF",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer invoice not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "PDF rendering or repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ]
      }
    },
    "/api/v1/customer-invoices/{invoice_id}/record-payment": {
      "post": {
        "operationId": "record_customer_invoice_payment",
        "parameters": [
          {
            "description": "Customer invoice UUID",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerInvoiceRecordPaymentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Customer invoice payment recorded, previewed, or staged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer invoice cannot accept the payment",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Staged operation not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Staging transition conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or staging error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ],
        "x-idempotency-debt-id": "POST /api/v1/customer-invoices/{invoice_id}/record-payment",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/customer-invoices/{invoice_id}/send": {
      "post": {
        "operationId": "send_customer_invoice",
        "parameters": [
          {
            "description": "Customer invoice UUID",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerInvoiceSendRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Customer invoice sent, previewed, or staged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer invoice cannot be sent",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Staged operation not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Staging transition conflict",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or staging error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invoice email delivery failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ],
        "x-idempotency-debt-id": "POST /api/v1/customer-invoices/{invoice_id}/send",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/customer-invoices/{invoice_id}/timeline": {
      "get": {
        "operationId": "get_customer_invoice_timeline",
        "parameters": [
          {
            "description": "Customer invoice UUID",
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_CustomerInvoiceTimelineEvent"
                }
              }
            },
            "description": "The invoice's event timeline, ordered by effective date",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Customer invoice not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "customer-invoices"
        ]
      }
    },
    "/api/v1/dashboard/activity": {
      "get": {
        "operationId": "activity",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardActivityResponse"
                }
              }
            },
            "description": "Recent company document activity",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "dashboard"
        ]
      }
    },
    "/api/v1/dashboard/customers": {
      "get": {
        "operationId": "customers",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "period",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "custom_from",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "custom_to",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardCustomersResponse"
                }
              }
            },
            "description": "Top customers by revenue",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "dashboard"
        ]
      }
    },
    "/api/v1/dashboard/pipeline": {
      "get": {
        "operationId": "pipeline",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardPipelineResponse"
                }
              }
            },
            "description": "Company document and pipeline approval counts",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "dashboard"
        ]
      }
    },
    "/api/v1/dashboard/summary": {
      "get": {
        "operationId": "summary",
        "parameters": [
          {
            "in": "query",
            "name": "period",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "custom_from",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "custom_to",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardSummaryResponse"
                }
              }
            },
            "description": "Company dashboard financial summary",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "dashboard"
        ]
      }
    },
    "/api/v1/dashboard/suppliers": {
      "get": {
        "operationId": "suppliers",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "period",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "custom_from",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "custom_to",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardSuppliersResponse"
                }
              }
            },
            "description": "Top suppliers by spend",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "dashboard"
        ]
      }
    },
    "/api/v1/documents": {
      "get": {
        "operationId": "list_documents",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "filename_search",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Filter by storage bucket: `accounting` (default), `contract`, `other`, or\n`all` for every category.",
            "in": "query",
            "name": "file_category",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentListOut"
                }
              }
            },
            "description": "Company documents",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/documents/search-corpus": {
      "get": {
        "operationId": "list_document_search_corpus",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "max_text_chars",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSearchCorpusOut"
                }
              }
            },
            "description": "Tenant-scoped document search material",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/documents/{doc_id}": {
      "delete": {
        "operationId": "delete_document",
        "parameters": [
          {
            "description": "Document id",
            "in": "path",
            "name": "doc_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteDocumentOut"
                }
              }
            },
            "description": "Deleted document and related storage objects",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or storage configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Failed to delete S3 objects",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "documents"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/documents/{doc_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "get": {
        "operationId": "get_document",
        "parameters": [
          {
            "description": "Document id",
            "in": "path",
            "name": "doc_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentOut"
                }
              }
            },
            "description": "Document detail",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/documents/{doc_id}/resolve-match": {
      "post": {
        "operationId": "resolve_document_match",
        "parameters": [
          {
            "description": "Document id",
            "in": "path",
            "name": "doc_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveMatchIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResolveMatchOut"
                }
              }
            },
            "description": "Resolved document match status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported resolution method",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "documents"
        ],
        "x-idempotency-debt-id": "POST /api/v1/documents/{doc_id}/resolve-match",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/documents/{doc_id}/view-url": {
      "get": {
        "operationId": "get_document_view_url",
        "parameters": [
          {
            "description": "Document id",
            "in": "path",
            "name": "doc_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Which stored object to serve: `auto` (default; prefers the lightweight\npreview derivative for images) or `original` (always the uploaded file).",
            "in": "query",
            "name": "variant",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "`inline` (default) or `attachment`. `attachment` always serves the\noriginal object and carries the document's original filename, so the\nURL triggers a download.",
            "in": "query",
            "name": "disposition",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PresignedUrlOut"
                }
              }
            },
            "description": "Presigned document view URL",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid variant or disposition",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Document or its stored object not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or storage configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Object store upstream failure",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/api/v1/employees": {
      "get": {
        "operationId": "list_employees",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_EmployeeResponse"
                }
              }
            },
            "description": "Employees for the current company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      },
      "post": {
        "operationId": "create_employee",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeResponse"
                }
              }
            },
            "description": "Employee created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid employee request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Card rule not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/banks": {
      "get": {
        "operationId": "list_banks",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_BankInfoResponse"
                }
              }
            },
            "description": "Swedish bank clearing-number metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      }
    },
    "/api/v1/employees/employer-declaration/{year}/{month}/download": {
      "get": {
        "operationId": "download_employer_declaration",
        "parameters": [
          {
            "description": "Salary period year",
            "in": "path",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Salary period month",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Employer declaration XML",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employer declaration not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employer declaration object read failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      }
    },
    "/api/v1/employees/employer-declaration/{year}/{month}/generate": {
      "post": {
        "operationId": "generate_employer_declaration",
        "parameters": [
          {
            "description": "Salary period year",
            "in": "path",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Salary period month",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployerDeclarationResponse"
                }
              }
            },
            "description": "Generated employer declaration",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employees or confirmed wage periods missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employer declaration object write failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/employer-declaration/{year}/{month}/generate",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/fortnox/preflight": {
      "post": {
        "operationId": "preview_fortnox_employee_setup",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PayrollEmployeePreflightRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayrollEmployeePreflightResponse"
                }
              }
            },
            "description": "Fortnox payroll employee setup preview",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid payroll employee preflight request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/fortnox/preflight",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/fortnox/staged/{staged_operation_id}/apply": {
      "post": {
        "operationId": "apply_staged_fortnox_employee_push",
        "parameters": [
          {
            "description": "Staged operation id",
            "in": "path",
            "name": "staged_operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "note",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Applied or replayed Fortnox employee staged operation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Staged operation or employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Operation cannot be applied in its current status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported or invalid staged operation payload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox employee write failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/fortnox/staged/{staged_operation_id}/apply",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/fortnox/synced": {
      "get": {
        "operationId": "list_synced_fortnox_employees",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_FortnoxEmployeeResponse"
                }
              }
            },
            "description": "Fortnox employee mirror rows for the current company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      }
    },
    "/api/v1/employees/payslip-email-preview/{year}/{month}": {
      "get": {
        "operationId": "payslip_email_preview",
        "parameters": [
          {
            "description": "Salary period year",
            "in": "path",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Salary period month",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayslipEmailPreviewResponse"
                }
              }
            },
            "description": "Payslip email recipient preview",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      }
    },
    "/api/v1/employees/salary-management/{year}/{month}": {
      "get": {
        "operationId": "salary_overview",
        "parameters": [
          {
            "description": "Salary period year",
            "in": "path",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Salary period month",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalaryOverviewResponse"
                }
              }
            },
            "description": "Salary management overview",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      }
    },
    "/api/v1/employees/salary-management/{year}/{month}/posting-preview": {
      "get": {
        "operationId": "payroll_posting_preview",
        "parameters": [
          {
            "description": "Salary period year",
            "in": "path",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Salary period month",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayrollPostingPreviewResponse"
                }
              }
            },
            "description": "Rule-pack payroll posting preview",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Confirmed wage periods or payroll routing data missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or rule-pack error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      }
    },
    "/api/v1/employees/salary-management/{year}/{month}/posting-stage": {
      "post": {
        "operationId": "stage_payroll_posting",
        "parameters": [
          {
            "description": "Salary period year",
            "in": "path",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Salary period month",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Staged rule-pack payroll posting",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Confirmed wage periods or payroll routing data missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Ledger staging rejected payroll posting",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or rule-pack error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/salary-management/{year}/{month}/posting-stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/salary-management/{year}/{month}/semesterersattning-termination-preview": {
      "post": {
        "operationId": "semesterersattning_termination_posting_preview",
        "parameters": [
          {
            "description": "Salary period year",
            "in": "path",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Salary period month",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SemesterersattningTerminationPostingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SemesterersattningTerminationPostingPreviewResponse"
                }
              }
            },
            "description": "Rule-pack termination semesterers\u00e4ttning posting preview",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Termination vacation-pay schedule or payroll routing data missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or rule-pack error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/salary-management/{year}/{month}/semesterersattning-termination-preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/salary-management/{year}/{month}/semesterersattning-termination-stage": {
      "post": {
        "operationId": "stage_semesterersattning_termination_posting",
        "parameters": [
          {
            "description": "Salary period year",
            "in": "path",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Salary period month",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SemesterersattningTerminationPostingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged rule-pack termination semesterers\u00e4ttning posting",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Termination vacation-pay schedule or payroll routing data missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Ledger staging rejected termination semesterers\u00e4ttning posting",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or rule-pack error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/salary-management/{year}/{month}/semesterersattning-termination-stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/salary-management/{year}/{month}/semesterloneskuld-preview": {
      "post": {
        "operationId": "semesterloneskuld_posting_preview",
        "parameters": [
          {
            "description": "Salary period year",
            "in": "path",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Salary period month",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SemesterloneskuldPostingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SemesterloneskuldPostingPreviewResponse"
                }
              }
            },
            "description": "Rule-pack semesterl\u00f6neskuld posting preview",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Vacation liability schedule or payroll routing data missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or rule-pack error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/salary-management/{year}/{month}/semesterloneskuld-preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/salary-management/{year}/{month}/semesterloneskuld-stage": {
      "post": {
        "operationId": "stage_semesterloneskuld_posting",
        "parameters": [
          {
            "description": "Salary period year",
            "in": "path",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Salary period month",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SemesterloneskuldPostingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged rule-pack semesterl\u00f6neskuld posting",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Vacation liability schedule or payroll routing data missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Ledger staging rejected semesterl\u00f6neskuld posting",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or rule-pack error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/salary-management/{year}/{month}/semesterloneskuld-stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/{employee_id}": {
      "delete": {
        "operationId": "delete_employee",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Employee deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/employees/{employee_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "get": {
        "operationId": "get_employee",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeResponse"
                }
              }
            },
            "description": "Employee for the current company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      },
      "put": {
        "operationId": "update_employee",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeResponse"
                }
              }
            },
            "description": "Employee updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid employee request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employee or card rule not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/employees/{employee_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/{employee_id}/expenses": {
      "get": {
        "operationId": "list_employee_expenses",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_EmployeeExpenseResponse"
                }
              }
            },
            "description": "Employee expenses linked through ledger lines",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Expense attachment presign failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      }
    },
    "/api/v1/employees/{employee_id}/fortnox/push": {
      "post": {
        "operationId": "push_employee_to_fortnox",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "stage",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmployeeFortnoxPushRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged or executed Fortnox employee push",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid Fortnox employee push request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox employee write conflicts with existing provider data",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employee is not ready for Fortnox write",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox employee write failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/{employee_id}/fortnox/push",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/{employee_id}/profile-picture": {
      "post": {
        "operationId": "presign_profile_picture",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmployeeProfilePicturePresignResponse"
                }
              }
            },
            "description": "Temporary profile-picture upload URL",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Profile picture presign failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/{employee_id}/profile-picture",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/{employee_id}/wage-periods": {
      "get": {
        "operationId": "list_wage_periods",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_WagePeriodResponse"
                }
              }
            },
            "description": "Employee wage periods for the current company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      },
      "post": {
        "operationId": "create_or_update_wage_period",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WagePeriodCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WagePeriodResponse"
                }
              }
            },
            "description": "Employee wage period created or updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid wage period request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid wage period payload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/{employee_id}/wage-periods",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/{employee_id}/wage-periods/{wp_id}": {
      "put": {
        "operationId": "update_wage_period",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Wage period id",
            "in": "path",
            "name": "wp_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WagePeriodUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WagePeriodResponse"
                }
              }
            },
            "description": "Employee wage period updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid wage period request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Wage period for employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid wage period payload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/employees/{employee_id}/wage-periods/{wp_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/{employee_id}/wage-periods/{wp_id}/parse": {
      "post": {
        "operationId": "parse_wage_text",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Wage period id",
            "in": "path",
            "name": "wp_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WagePeriodParseResponse"
                }
              }
            },
            "description": "Parsed wage period text",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No raw text to parse",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Wage period for employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid wage text",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "salary-management"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/{employee_id}/wage-periods/{wp_id}/parse",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/employees/{employee_id}/wage-periods/{wp_id}/payslip": {
      "get": {
        "operationId": "download_payslip",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Wage period id",
            "in": "path",
            "name": "wp_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayslipDownloadResponse"
                }
              }
            },
            "description": "Temporary payslip download URL",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Complete posted L-series payroll lineage is required before downloading payslip",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Wage period for employee or payslip not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Payslip presign failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      },
      "post": {
        "operationId": "generate_payslip",
        "parameters": [
          {
            "description": "Employee id",
            "in": "path",
            "name": "employee_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Wage period id",
            "in": "path",
            "name": "wp_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayslipGenerationResponse"
                }
              }
            },
            "description": "Generated payslip object and optional email delivery",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Complete posted L-series payroll lineage is required before generating payslip",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Wage period for employee not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Payslip object write failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ],
        "x-idempotency-debt-id": "POST /api/v1/employees/{employee_id}/wage-periods/{wp_id}/payslip",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/feedback": {
      "post": {
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid authentication",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Submit in-app user feedback",
        "tags": [
          "feedback"
        ],
        "x-idempotency-debt-id": "POST /api/v1/feedback",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fiscal-periods": {
      "get": {
        "operationId": "list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_FiscalPeriodResponse"
                }
              }
            },
            "description": "Fiscal periods for the company ordered by period_start DESC",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fiscal-periods"
        ]
      },
      "post": {
        "operationId": "create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FiscalPeriodCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Fiscal period created in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid fiscal-period dates",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period overlaps an existing period",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fiscal-periods"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fiscal-periods",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fiscal-periods/{id}": {
      "delete": {
        "operationId": "delete",
        "parameters": [
          {
            "description": "Fiscal period UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Fiscal period deleted in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Locked or closed fiscal period cannot be deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period contains ledger entries",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fiscal-periods"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/fiscal-periods/{id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "patch": {
        "operationId": "update",
        "parameters": [
          {
            "description": "Fiscal period UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FiscalPeriodUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Fiscal period updated in a write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid state or fiscal-period dates",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period overlaps an existing period",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fiscal-periods"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/fiscal-periods/{id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fiscal-periods/{id}/lock": {
      "post": {
        "operationId": "lock",
        "parameters": [
          {
            "description": "Fiscal period UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FiscalPeriodResponse"
                }
              }
            },
            "description": "Fiscal period locked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Closed periods cannot be locked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fiscal-periods"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fiscal-periods/{id}/lock",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fiscal-periods/{id}/unlock": {
      "post": {
        "operationId": "unlock",
        "parameters": [
          {
            "description": "Fiscal period UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FiscalPeriodResponse"
                }
              }
            },
            "description": "Fiscal period unlocked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Closed periods cannot be unlocked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fiscal-periods"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fiscal-periods/{id}/unlock",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fortnox/source-control/payroll-time/pull": {
      "post": {
        "operationId": "pull_payroll_time",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceControlPayrollTimePullRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlPayrollTimeReviewResponse"
                }
              }
            },
            "description": "Fortnox payroll-time source-control pull review result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox is not connected or a payroll-time review is applying",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fortnox/source-control/payroll-time/pull",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fortnox/source-control/payroll-time/review": {
      "get": {
        "operationId": "review_payroll_time",
        "parameters": [
          {
            "description": "Include review row payloads",
            "in": "query",
            "name": "include_steps",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlPayrollTimeReviewResponse"
                }
              }
            },
            "description": "Current Fortnox payroll-time source-control review state",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ]
      }
    },
    "/api/v1/fortnox/source-control/payroll-time/runs/{run_id}/push": {
      "post": {
        "operationId": "push_payroll_time",
        "parameters": [
          {
            "description": "Payroll-time integration sync run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlPayrollTimePushResponse"
                }
              }
            },
            "description": "Fortnox payroll-time source-control push result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run is not ready for payroll-time push",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fortnox/source-control/payroll-time/runs/{run_id}/push",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fortnox/source-control/pull": {
      "post": {
        "operationId": "pull",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceControlPullRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlPullDispatchResponse"
                }
              }
            },
            "description": "Fortnox source-control pull accepted; poll integration-sync status for progress",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid pull scope or limit",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox is not connected or a review is applying",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fortnox/source-control/pull",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fortnox/source-control/review": {
      "get": {
        "operationId": "review",
        "parameters": [
          {
            "description": "Include full review rows and provider voucher references",
            "in": "query",
            "name": "include_steps",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlReviewResponse"
                }
              }
            },
            "description": "Current Fortnox source-control review state",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ]
      }
    },
    "/api/v1/fortnox/source-control/runs/{run_id}/cancel": {
      "post": {
        "operationId": "cancel",
        "parameters": [
          {
            "description": "Integration sync run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlCancelResponse"
                }
              }
            },
            "description": "Fortnox source-control run cancellation result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run is not a bookkeeping source-control run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fortnox/source-control/runs/{run_id}/cancel",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fortnox/source-control/runs/{run_id}/import-inbox": {
      "post": {
        "operationId": "import_inbox",
        "parameters": [
          {
            "description": "Integration sync run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceControlInboxImportRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlInboxImportResponse"
                }
              }
            },
            "description": "Fortnox source-control Inbox import result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fortnox/source-control/runs/{run_id}/import-inbox",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fortnox/source-control/runs/{run_id}/post-ledger": {
      "post": {
        "operationId": "post_ledger",
        "parameters": [
          {
            "description": "Integration sync run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceControlPostLedgerRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlPostLedgerResponse"
                }
              }
            },
            "description": "Fortnox source-control post-ledger result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run is not a bookkeeping source-control run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fortnox/source-control/runs/{run_id}/post-ledger",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fortnox/source-control/runs/{run_id}/push": {
      "post": {
        "operationId": "push",
        "parameters": [
          {
            "description": "Integration sync run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceControlPushRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlPushDispatchResponse"
                }
              }
            },
            "description": "Fortnox source-control push dispatched; poll integration-sync status for progress",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run is not a bookkeeping source-control run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fortnox/source-control/runs/{run_id}/push",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fortnox/source-control/runs/{run_id}/verify-head": {
      "post": {
        "operationId": "verify_head",
        "parameters": [
          {
            "description": "Integration sync run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceControlHeadCheckRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlHeadCheckResponse"
                }
              }
            },
            "description": "Fortnox source-control provider head verification",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run is not a bookkeeping source-control run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fortnox/source-control/runs/{run_id}/verify-head",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fortnox/source-control/runs/{run_id}/verify-local-snapshot": {
      "post": {
        "operationId": "verify_local_snapshot",
        "parameters": [
          {
            "description": "Integration sync run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlLocalSnapshotResponse"
                }
              }
            },
            "description": "Fortnox source-control local snapshot verification",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run is not a bookkeeping source-control run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-source-control"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fortnox/source-control/runs/{run_id}/verify-local-snapshot",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/fortnox/sync/run": {
      "post": {
        "operationId": "run",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FortnoxSyncJobRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FortnoxSyncJobResponse"
                }
              }
            },
            "description": "Fortnox sync job finished",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox is not connected for the company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-sync"
        ],
        "x-idempotency-debt-id": "POST /api/v1/fortnox/sync/run",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/health": {
      "get": {
        "operationId": "health",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "health"
        ]
      }
    },
    "/api/v1/health/schedulers": {
      "get": {
        "operationId": "scheduler_health",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SchedulerHealthResponse"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "health"
        ]
      }
    },
    "/api/v1/inbox/browser-agent/bank-suggestions": {
      "get": {
        "operationId": "bank_suggestions",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentBankSuggestionsResponse"
                }
              }
            },
            "description": "Suggested browser-agent sources from unmatched bank transactions",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ]
      }
    },
    "/api/v1/inbox/browser-agent/connections": {
      "get": {
        "operationId": "list_connections",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentConnectionListResponse"
                }
              }
            },
            "description": "Current user's browser-agent connections",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ]
      },
      "post": {
        "operationId": "create_connection",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserAgentConnectionCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentConnectionResponse"
                }
              }
            },
            "description": "Created or updated browser-agent connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid connection request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Requested profile not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ],
        "x-idempotency-debt-id": "POST /api/v1/inbox/browser-agent/connections",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/inbox/browser-agent/connections/{connection_id}": {
      "get": {
        "operationId": "get_connection",
        "parameters": [
          {
            "description": "Browser-agent connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentConnectionResponse"
                }
              }
            },
            "description": "Browser-agent connection for the current user",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ]
      }
    },
    "/api/v1/inbox/browser-agent/connections/{connection_id}/runs": {
      "post": {
        "operationId": "create_run",
        "parameters": [
          {
            "description": "Browser-agent connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserAgentRunCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentRunCreateResponse"
                }
              }
            },
            "description": "Created or reused browser-agent run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection is not ready to fetch invoices",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Browser-agent or workflow API is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ],
        "x-idempotency-debt-id": "POST /api/v1/inbox/browser-agent/connections/{connection_id}/runs",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/inbox/browser-agent/connections/{connection_id}/setup-complete": {
      "post": {
        "operationId": "complete_setup_session",
        "parameters": [
          {
            "description": "Browser-agent connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserAgentSetupCompleteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentSetupCompleteResponse"
                }
              }
            },
            "description": "Completed browser-agent setup verification",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection or setup session not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Workflow API unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ],
        "x-idempotency-debt-id": "POST /api/v1/inbox/browser-agent/connections/{connection_id}/setup-complete",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/inbox/browser-agent/connections/{connection_id}/setup-session": {
      "post": {
        "operationId": "create_setup_session",
        "parameters": [
          {
            "description": "Browser-agent connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserAgentSetupSessionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentSetupSessionResponse"
                }
              }
            },
            "description": "Created or reused browser-agent setup session",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Workflow API unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ],
        "x-idempotency-debt-id": "POST /api/v1/inbox/browser-agent/connections/{connection_id}/setup-session",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/inbox/browser-agent/connections/{connection_id}/setup-session/active": {
      "get": {
        "operationId": "active_setup_session",
        "parameters": [
          {
            "description": "Browser-agent connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentSetupSessionResponse"
                }
              }
            },
            "description": "Active setup session for a browser-agent connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection or active setup session not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ]
      }
    },
    "/api/v1/inbox/browser-agent/connections/{connection_id}/setup-session/{setup_session_id}/cancel": {
      "post": {
        "operationId": "cancel_setup_session",
        "parameters": [
          {
            "description": "Browser-agent connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Browser-agent setup session id",
            "in": "path",
            "name": "setup_session_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentSetupSessionResponse"
                }
              }
            },
            "description": "Cancelled browser-agent setup session",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection or setup session not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Workflow API unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ],
        "x-idempotency-debt-id": "POST /api/v1/inbox/browser-agent/connections/{connection_id}/setup-session/{setup_session_id}/cancel",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/inbox/browser-agent/readiness": {
      "get": {
        "operationId": "get_readiness",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentReadiness"
                }
              }
            },
            "description": "Browser-agent readiness status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ]
      }
    },
    "/api/v1/inbox/browser-agent/resolve-source": {
      "post": {
        "operationId": "resolve_source",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserAgentSourceResolveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentSourceResolveResponse"
                }
              }
            },
            "description": "Resolved a browser-agent source query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid source query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ],
        "x-idempotency-debt-id": "POST /api/v1/inbox/browser-agent/resolve-source",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/inbox/browser-agent/runs/{run_id}": {
      "get": {
        "operationId": "get_run",
        "parameters": [
          {
            "description": "Browser-agent run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentRunResponse"
                }
              }
            },
            "description": "Browser-agent run for the current user",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ]
      }
    },
    "/api/v1/inbox/browser-agent/runs/{run_id}/artifacts": {
      "get": {
        "operationId": "get_run_artifacts",
        "parameters": [
          {
            "description": "Browser-agent run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentArtifactListResponse"
                }
              }
            },
            "description": "Browser-agent artifacts for a run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ]
      }
    },
    "/api/v1/inbox/browser-agent/runs/{run_id}/cancel": {
      "post": {
        "operationId": "cancel_run",
        "parameters": [
          {
            "description": "Browser-agent run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentRunResponse"
                }
              }
            },
            "description": "Cancelled browser-agent run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ],
        "x-idempotency-debt-id": "POST /api/v1/inbox/browser-agent/runs/{run_id}/cancel",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/inbox/browser-agent/suggested-sites": {
      "get": {
        "operationId": "suggested_sites",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserAgentSuggestedSitesResponse"
                }
              }
            },
            "description": "Browser-agent suggested supplier sites",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "browser-agent"
        ]
      }
    },
    "/api/v1/integrations/bjornlunden/connect": {
      "post": {
        "operationId": "bjornlunden_connect",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BjornlundenConnectRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderConnectResponse"
                }
              }
            },
            "description": "Bjornlunden integration connected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Provider credential verification failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/bjornlunden/connect",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/bjornlunden/disconnect": {
      "delete": {
        "operationId": "bjornlunden_disconnect",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderDisconnectResponse"
                }
              }
            },
            "description": "Bjornlunden integration disconnected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/bjornlunden/disconnect",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/bjornlunden/status": {
      "get": {
        "operationId": "bjornlunden_status",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManualProviderStatusResponse"
                }
              }
            },
            "description": "Bjornlunden integration status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/bokio/connect": {
      "post": {
        "operationId": "bokio_connect",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BokioConnectRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderConnectResponse"
                }
              }
            },
            "description": "Bokio integration connected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/bokio/connect",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/bokio/disconnect": {
      "delete": {
        "operationId": "bokio_disconnect",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderDisconnectResponse"
                }
              }
            },
            "description": "Bokio integration disconnected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/bokio/disconnect",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/bokio/status": {
      "get": {
        "operationId": "bokio_status",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManualProviderStatusResponse"
                }
              }
            },
            "description": "Bokio integration status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/briox/connect": {
      "post": {
        "operationId": "briox_connect",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrioxConnectRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderConnectResponse"
                }
              }
            },
            "description": "Briox integration connected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Provider credential verification failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Provider integration is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/briox/connect",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/briox/disconnect": {
      "delete": {
        "operationId": "briox_disconnect",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderDisconnectResponse"
                }
              }
            },
            "description": "Briox integration disconnected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/briox/disconnect",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/briox/status": {
      "get": {
        "operationId": "briox_status",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManualProviderStatusResponse"
                }
              }
            },
            "description": "Briox integration status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/email-inbox/activity": {
      "get": {
        "operationId": "activity",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailInboxActivityResponse"
                }
              }
            },
            "description": "Recent company email inbox activity",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "email-inbox"
        ]
      }
    },
    "/api/v1/integrations/email-inbox/allowlist": {
      "get": {
        "operationId": "list_allowlist",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailInboxAllowlistListResponse"
                }
              }
            },
            "description": "Company email inbox sender allowlist",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "email-inbox"
        ]
      },
      "post": {
        "operationId": "add_allowlist",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailInboxAddAllowlistRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailInboxAllowlistEntryResponse"
                }
              }
            },
            "description": "Allowlist entry created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid allowlist pattern",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Duplicate allowlist pattern",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Allowlist pattern failed validation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "email-inbox"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/email-inbox/allowlist",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/email-inbox/allowlist/{entry_id}": {
      "delete": {
        "operationId": "delete_allowlist",
        "parameters": [
          {
            "description": "Allowlist entry id",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailInboxDeleteResponse"
                }
              }
            },
            "description": "Allowlist entry deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Allowlist entry not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "email-inbox"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/email-inbox/allowlist/{entry_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/email-inbox/ingest": {
      "post": {
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid authentication",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Ingest an inbound email-inbox webhook event",
        "tags": [
          "email-inbox"
        ],
        "x-idempotency-deduplication": "The handler must deduplicate using provider event identity, callback state, or stored webhook receipt state.",
        "x-idempotency-explanation": "Ingress endpoint; replay safety is owned by the provider/webhook-specific durable handler.",
        "x-idempotency-policy": "external_ingress"
      }
    },
    "/api/v1/integrations/email-inbox/provision": {
      "post": {
        "operationId": "provision",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailInboxStateResponse"
                }
              }
            },
            "description": "Provisioned company email inbox setup state",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Email inbox token collision",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "email-inbox"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/email-inbox/provision",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/email-inbox/regenerate": {
      "post": {
        "operationId": "regenerate",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailInboxStateResponse"
                }
              }
            },
            "description": "Regenerated company email inbox setup state",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Email inbox token collision",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "email-inbox"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/email-inbox/regenerate",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/email-inbox/state": {
      "get": {
        "operationId": "get_state",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailInboxStateResponse"
                }
              }
            },
            "description": "Current company email inbox setup state",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "email-inbox"
        ]
      },
      "post": {
        "operationId": "set_state",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailInboxSetEnabledRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailInboxStateResponse"
                }
              }
            },
            "description": "Updated company email inbox setup state",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Email inbox has not been provisioned",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "email-inbox"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/email-inbox/state",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/email-inbox/test-ping": {
      "post": {
        "operationId": "test_ping",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailInboxTestPingResponse"
                }
              }
            },
            "description": "Whether a recent non-confirmation inbox email was received",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "email-inbox"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/email-inbox/test-ping",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/enable-banking/aspsps": {
      "get": {
        "operationId": "list_aspsps",
        "parameters": [
          {
            "description": "Two-letter ISO country code, defaults to se",
            "in": "query",
            "name": "country",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional Enable Banking PSU type filter",
            "in": "query",
            "name": "psu_type",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_EnableBankingAspspResponse"
                }
              }
            },
            "description": "Enable Banking ASPSPs available for AIS",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking rate limit reached",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or credential error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking workflow read failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "enable-banking"
        ]
      }
    },
    "/api/v1/integrations/enable-banking/connections": {
      "get": {
        "operationId": "list_connections",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableBankingConnectionListResponse"
                }
              }
            },
            "description": "Enable Banking connections for the current company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "enable-banking"
        ]
      },
      "post": {
        "operationId": "create_connection",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnableBankingCreateConnectionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableBankingCreateConnectionResponse"
                }
              }
            },
            "description": "Created pending Enable Banking connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid connection request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking rate limit reached",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or credential error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking workflow write failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "enable-banking"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/enable-banking/connections",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/enable-banking/connections/callback": {
      "post": {
        "operationId": "callback",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnableBankingCallbackRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableBankingCallbackResponse"
                }
              }
            },
            "description": "Finalized Enable Banking connection callback",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid callback payload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection state not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking consent has expired",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking rate limit reached",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or credential error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking workflow callback failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "enable-banking"
        ],
        "x-idempotency-deduplication": "The handler must deduplicate using provider event identity, callback state, or stored webhook receipt state.",
        "x-idempotency-explanation": "Ingress endpoint; replay safety is owned by the provider/webhook-specific durable handler.",
        "x-idempotency-policy": "external_ingress"
      }
    },
    "/api/v1/integrations/enable-banking/connections/{connection_id}": {
      "delete": {
        "operationId": "delete_connection",
        "parameters": [
          {
            "description": "Enable Banking session row ID",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted Enable Banking connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking consent has expired",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking rate limit reached",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or credential error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking workflow delete failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "enable-banking"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/enable-banking/connections/{connection_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/enable-banking/connections/{connection_id}/accounts/{eb_account_uid}/mapping": {
      "put": {
        "operationId": "update_account_mapping",
        "parameters": [
          {
            "description": "Enable Banking session row ID",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Enable Banking account UID to (re)map",
            "in": "path",
            "name": "eb_account_uid",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnableBankingAccountMappingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableBankingAccountMappingResponse"
                }
              }
            },
            "description": "Updated the account mapping",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid target bank account id",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking account or target not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "enable-banking"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/integrations/enable-banking/connections/{connection_id}/accounts/{eb_account_uid}/mapping",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/enable-banking/connections/{connection_id}/schedule": {
      "put": {
        "operationId": "update_connection_schedule",
        "parameters": [
          {
            "description": "Enable Banking session row ID",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Client-generated retry key mapped into the Temporal workflow identity",
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnableBankingScheduleUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableBankingWorkflowDispatchResponse"
                }
              }
            },
            "description": "Dispatched Enable Banking bank-feed schedule workflow",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid schedule request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Workflow API rejected the schedule request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking or workflow API is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "enable-banking"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/integrations/enable-banking/connections/{connection_id}/schedule",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/enable-banking/connections/{connection_id}/sync": {
      "post": {
        "operationId": "sync_connection",
        "parameters": [
          {
            "description": "Enable Banking session row ID",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableBankingWorkflowDispatchResponse"
                }
              }
            },
            "description": "Dispatched Enable Banking bank-feed sync workflow",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking consent has expired",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking rate limit reached",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or credential error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking workflow sync failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Enable Banking is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "enable-banking"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/enable-banking/connections/{connection_id}/sync",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/enable-banking/status": {
      "get": {
        "operationId": "status",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableBankingStatusResponse"
                }
              }
            },
            "description": "Enable Banking integration status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "enable-banking"
        ]
      }
    },
    "/api/v1/integrations/fortnox/callback": {
      "get": {
        "operationId": "fortnox_callback",
        "parameters": [
          {
            "description": "Fortnox OAuth authorization code",
            "in": "query",
            "name": "code",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Signed OAuth state from the connect route",
            "in": "query",
            "name": "state",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fortnox OAuth error",
            "in": "query",
            "name": "error",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fortnox OAuth error description",
            "in": "query",
            "name": "error_description",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the frontend Fortnox connection result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unexpected callback processing failure",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/fortnox/connect": {
      "get": {
        "operationId": "fortnox_connect",
        "parameters": [
          {
            "description": "Request attachment/archive scopes",
            "in": "query",
            "name": "include_attachments",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "description": "Override Fortnox OAuth scopes",
            "in": "query",
            "name": "scope_override",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Frontend path to redirect to after OAuth completes",
            "in": "query",
            "name": "return_to",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FortnoxConnectResponse"
                }
              }
            },
            "description": "Fortnox OAuth authorization URL",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Provider integration is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/fortnox/debug-config": {
      "get": {
        "operationId": "fortnox_debug_config",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FortnoxDebugConfigResponse"
                }
              }
            },
            "description": "Sanitized Fortnox OAuth runtime configuration",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/fortnox/disconnect": {
      "delete": {
        "operationId": "fortnox_disconnect",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderDisconnectResponse"
                }
              }
            },
            "description": "Fortnox integration disconnected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/fortnox/disconnect",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/fortnox/inbox/pull": {
      "post": {
        "operationId": "fortnox_inbox_pull",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FortnoxInboxPullRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FortnoxInboxPullResponse"
                }
              }
            },
            "description": "Fortnox Inbox pull result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported Fortnox Inbox folder",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox token refresh failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox token cannot access Inbox files",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox is not connected for this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/fortnox/inbox/pull",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/fortnox/inbox/status": {
      "get": {
        "operationId": "fortnox_inbox_status",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FortnoxInboxStatusResponse"
                }
              }
            },
            "description": "Fortnox Inbox import status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/fortnox/proxy": {
      "get": {
        "operationId": "fortnox_proxy",
        "parameters": [
          {
            "description": "Fortnox API path, e.g. /3/invoices",
            "in": "query",
            "name": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Fortnox JSON response",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid proxy path",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth or Fortnox token",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Blocked proxy path or company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No Fortnox credentials found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox rate limit",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox API unreachable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "504": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox API timed out",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "fortnox-proxy"
        ]
      }
    },
    "/api/v1/integrations/fortnox/shared-callback": {
      "get": {
        "operationId": "fortnox_shared_callback",
        "parameters": [
          {
            "description": "Fortnox OAuth code",
            "in": "query",
            "name": "code",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Signed OAuth state",
            "in": "query",
            "name": "state",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fortnox OAuth error",
            "in": "query",
            "name": "error",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fortnox OAuth error description",
            "in": "query",
            "name": "error_description",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to environment-specific Fortnox callback",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid OAuth state",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/fortnox/status": {
      "get": {
        "operationId": "fortnox_status",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FortnoxStatusResponse"
                }
              }
            },
            "description": "Fortnox integration status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/platform-feeds/{connection_id}/balance": {
      "get": {
        "operationId": "platform_feed_balance",
        "parameters": [
          {
            "description": "Integration connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformFeedBalanceResponse"
                }
              }
            },
            "description": "Per-currency platform balances",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/platform-feeds/{connection_id}/groups": {
      "get": {
        "operationId": "platform_feed_groups",
        "parameters": [
          {
            "description": "Integration connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformFeedRuleGroupsResponse"
                }
              }
            },
            "description": "Provider-observed platform transaction groups",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/platform-feeds/{connection_id}/groups/{group_key}/vat-resolution": {
      "put": {
        "operationId": "resolve_platform_feed_group_vat_route",
        "parameters": [
          {
            "description": "Integration connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Exact observed platform-feed group key",
            "in": "path",
            "name": "group_key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolvePlatformFeedVatRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResolvePlatformFeedVatResponse"
                }
              }
            },
            "description": "VAT evidence recorded for every still-actionable row in the reviewed group",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Group is not eligible for Swedish VAT resolution",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No actionable rows remain in the exact group",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "The group changed since it was reviewed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Other provider evidence is still missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/integrations/platform-feeds/{connection_id}/groups/{group_key}/vat-resolution",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/platform-feeds/{connection_id}/ledger-proposals/{operation_id}/apply": {
      "post": {
        "operationId": "apply_platform_feed_ledger_proposal_route",
        "parameters": [
          {
            "description": "Integration connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Staged ledger proposal operation id",
            "in": "path",
            "name": "operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformFeedProposalApplyResponse"
                }
              }
            },
            "description": "Proposal booked as draft ledger entries",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/platform-feeds/{connection_id}/ledger-proposals/{operation_id}/apply",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/platform-feeds/{connection_id}/runs": {
      "get": {
        "operationId": "platform_feed_runs",
        "parameters": [
          {
            "description": "Integration connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformFeedRunsResponse"
                }
              }
            },
            "description": "Sync schedule + newest-first run history",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/platform-feeds/{connection_id}/transactions": {
      "get": {
        "operationId": "platform_feed_transactions",
        "parameters": [
          {
            "description": "Integration connection id",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional canonical accounting group",
            "in": "query",
            "name": "group_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional UTC day in YYYY-MM-DD",
            "in": "query",
            "name": "day",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Optional currency paired with the selected UTC day",
            "in": "query",
            "name": "currency",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "One-based page number",
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Transactions per page, 1-100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformFeedTransactionsResponse"
                }
              }
            },
            "description": "Paginated safe transaction evidence and UTC day bands",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid pagination or group filter",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Requested transaction group was not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/providers": {
      "get": {
        "operationId": "provider_catalog",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderCatalogResponse"
                }
              }
            },
            "description": "Backend-authoritative integration provider catalog",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/providers/{provider_id}/connections": {
      "get": {
        "operationId": "provider_connections",
        "parameters": [
          {
            "description": "Provider identifier",
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_ProviderConnectionResponse"
                }
              }
            },
            "description": "Tenant integration connections",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported provider",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      },
      "post": {
        "operationId": "provider_connect",
        "parameters": [
          {
            "description": "Provider identifier",
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProviderConnectionCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderConnectionResponse"
                }
              }
            },
            "description": "Tenant integration connection created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid provider credentials",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/providers/{provider_id}/connections",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/providers/{provider_id}/connections/{connection_id}": {
      "delete": {
        "operationId": "provider_connection_delete",
        "parameters": [
          {
            "description": "Provider identifier",
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Tenant connection identifier",
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderDisconnectResponse"
                }
              }
            },
            "description": "Tenant integration connection disabled",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported provider",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/providers/{provider_id}/connections/{connection_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/providers/{provider_id}/connections/{connection_id}/voucher-series": {
      "put": {
        "operationId": "provider_connection_voucher_series",
        "parameters": [
          {
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProviderConnectionVoucherSeriesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderConnectionResponse"
                }
              }
            },
            "description": "Integration voucher series updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid or inactive voucher series",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Connection not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/integrations/providers/{provider_id}/connections/{connection_id}/voucher-series",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/providers/{provider_id}/tenant-profiles": {
      "get": {
        "operationId": "provider_tenant_profiles",
        "parameters": [
          {
            "description": "Provider id",
            "in": "path",
            "name": "provider_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Profile status filter: active, draft, retired, or all",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationTenantProfileListResponse"
                }
              }
            },
            "description": "Tenant integration profiles",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Provider does not support tenant profiles",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/shopify/callback": {
      "get": {
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid authentication",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Shopify OAuth redirect callback",
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/shopify/connect": {
      "post": {
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid authentication",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Connect a Shopify shop (start the per-shop OAuth flow)",
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/shopify/connect",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/shopify/connections": {
      "get": {
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid authentication",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "List connected Shopify shops",
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/shopify/connections/{connection_id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid authentication",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Disconnect one Shopify shop",
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/shopify/connections/{connection_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/shopify/connections/{connection_id}/voucher-series": {
      "put": {
        "operationId": "shopify_set_voucher_series",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShopifyVoucherSeriesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShopifyConnectionResponse"
                }
              }
            },
            "description": "Shopify voucher series updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid or inactive voucher series",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller may not manage the Shopify connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Shopify connection not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Shopify connection could not be updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/integrations/shopify/connections/{connection_id}/voucher-series",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/stripe/callback": {
      "get": {
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid authentication",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Stripe OAuth redirect callback",
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/stripe/connect": {
      "post": {
        "operationId": "stripe_connect",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StripeConnectRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeAuthorizeUrlResponse"
                }
              }
            },
            "description": "Stripe Connect authorize URL",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller may not manage the Stripe connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Stripe Connect is not configured on this server",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/stripe/connect",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/stripe/connections": {
      "get": {
        "operationId": "stripe_connections",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/StripeConnectionResponse"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Stripe connections",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/stripe/connections/{connection_id}": {
      "delete": {
        "operationId": "stripe_disconnect",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Stripe connection disabled",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller may not manage the Stripe connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/stripe/connections/{connection_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/stripe/connections/{connection_id}/intent": {
      "put": {
        "operationId": "stripe_set_intent",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StripeIntentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeConnectionResponse"
                }
              }
            },
            "description": "Updated Stripe connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid processing intent",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller may not manage the Stripe connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/integrations/stripe/connections/{connection_id}/intent",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/stripe/connections/{connection_id}/invoice-webhook": {
      "put": {
        "operationId": "stripe_set_invoice_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StripeWebhookRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeConnectionResponse"
                }
              }
            },
            "description": "Updated real-time invoice ingestion",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Platform webhook endpoint is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller may not manage the Stripe connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/integrations/stripe/connections/{connection_id}/invoice-webhook",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/stripe/connections/{connection_id}/voucher-series": {
      "put": {
        "operationId": "stripe_set_voucher_series",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StripeVoucherSeriesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeConnectionResponse"
                }
              }
            },
            "description": "Updated Stripe voucher series",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid or inactive voucher series",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Stripe connection not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/integrations/stripe/connections/{connection_id}/voucher-series",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/telegram/connections": {
      "get": {
        "operationId": "telegram_connections",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TelegramConnectionResponse"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Telegram bot connections",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      },
      "post": {
        "operationId": "telegram_connect",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TelegramConnectRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TelegramConnectionResponse"
                }
              }
            },
            "description": "Telegram bot connected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid Telegram connection request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller may not manage the Telegram connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Telegram integration is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/telegram/connections",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/telegram/connections/{connection_id}": {
      "delete": {
        "operationId": "telegram_disconnect",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Telegram bot disconnected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller may not manage the Telegram connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Telegram integration is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/telegram/connections/{connection_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/telegram/connections/{connection_id}/intent": {
      "put": {
        "operationId": "telegram_set_intent",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TelegramIntentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TelegramConnectionResponse"
                }
              }
            },
            "description": "Default processing intent updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid processing intent",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Caller may not manage the Telegram connection",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Telegram integration is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/integrations/telegram/connections/{connection_id}/intent",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/visma/callback": {
      "get": {
        "operationId": "visma_callback",
        "parameters": [
          {
            "description": "Visma OAuth authorization code",
            "in": "query",
            "name": "code",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Signed OAuth state from the connect route",
            "in": "query",
            "name": "state",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Visma OAuth error code",
            "in": "query",
            "name": "error",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Visma OAuth error description",
            "in": "query",
            "name": "error_description",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the frontend Visma connection result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unexpected callback processing failure",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/visma/connect": {
      "get": {
        "operationId": "visma_connect",
        "parameters": [
          {
            "description": "Frontend path to redirect to after OAuth completes",
            "in": "query",
            "name": "return_to",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VismaConnectResponse"
                }
              }
            },
            "description": "Visma OAuth authorization URL",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Provider integration is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/visma/disconnect": {
      "delete": {
        "operationId": "visma_disconnect",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderDisconnectResponse"
                }
              }
            },
            "description": "Visma integration disconnected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/visma/disconnect",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/visma/status": {
      "get": {
        "operationId": "visma_status",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OauthProviderStatusResponse"
                }
              }
            },
            "description": "Visma integration status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/integrations/whatsapp/senders": {
      "get": {
        "operationId": "whatsapp_senders",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/WhatsAppSenderResponse"
                  },
                  "type": "array"
                }
              }
            },
            "description": "WhatsApp sender links for the company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      },
      "post": {
        "operationId": "create_whatsapp_sender",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WhatsAppSenderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WhatsAppSenderResponse"
                }
              }
            },
            "description": "WhatsApp sender link created or updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid WhatsApp sender request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/integrations/whatsapp/senders",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/whatsapp/senders/{sender_id}": {
      "delete": {
        "operationId": "delete_whatsapp_sender",
        "parameters": [
          {
            "description": "WhatsApp sender link UUID",
            "in": "path",
            "name": "sender_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "WhatsApp sender link removed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/integrations/whatsapp/senders/{sender_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "put": {
        "operationId": "update_whatsapp_sender",
        "parameters": [
          {
            "description": "WhatsApp sender link UUID",
            "in": "path",
            "name": "sender_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WhatsAppSenderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WhatsAppSenderResponse"
                }
              }
            },
            "description": "WhatsApp sender link updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid WhatsApp sender request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/integrations/whatsapp/senders/{sender_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/integrations/{provider}/ingestion-detail": {
      "get": {
        "operationId": "ingestion_detail",
        "parameters": [
          {
            "description": "Provider id, e.g. stripe, whatsapp, telegram",
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationIngestionDetail"
                }
              }
            },
            "description": "Invoice-ingestion health summary",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "integrations"
        ]
      }
    },
    "/api/v1/ledger-entries": {
      "get": {
        "operationId": "list_entries",
        "parameters": [
          {
            "description": "Filter to entries with this status (`draft`, `posted`, `reversed`).",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Filter to entries with this source_type (`supplier_invoice`,\n`bank_transaction`, etc.).",
            "in": "query",
            "name": "source_type",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Max rows returned. Clamped to 1..=500.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_LedgerEntryResponse"
                }
              }
            },
            "description": "List of ledger entries for the company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ]
      }
    },
    "/api/v1/ledger-entries/export-pending": {
      "post": {
        "operationId": "export_pending",
        "parameters": [
          {
            "description": "Accepted for parity with the Python route; the reviewed source-control run supplies the export set",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int32",
              "minimum": 0,
              "type": "integer"
            }
          },
          {
            "description": "Must be true after reviewing /ledger-entries/export-plan",
            "in": "query",
            "name": "confirm",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceControlPushResponse"
                }
              }
            },
            "description": "Fortnox bookkeeping export result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No supported accounting integration is connected or query input is invalid",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No current reconciliation table; pull from the integration first",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Confirmation is missing or the reviewed sync plan is blocked",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or source-control error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/ledger-entries/export-pending",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ledger-entries/export-plan": {
      "get": {
        "operationId": "export_plan",
        "parameters": [
          {
            "description": "Accepted for parity with the Python route; the active run is returned whole",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int32",
              "minimum": 0,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActiveRunStatus"
                }
              }
            },
            "description": "The active bookkeeping reconciliation run to export from",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No current reconciliation table; pull from the integration first",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Could not load export plan",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ]
      }
    },
    "/api/v1/ledger-entries/export-pull-status": {
      "get": {
        "operationId": "export_pull_status",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerExportPullStatusResponse"
                }
              }
            },
            "description": "Fortnox bookkeeping pull status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ]
      }
    },
    "/api/v1/ledger-entries/integration-sync/financial-years": {
      "post": {
        "operationId": "import_financial_years",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FortnoxFinancialYearImportResponse"
                }
              }
            },
            "description": "Imported Fortnox financial years and reconciled fiscal periods",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox is not connected for the company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fortnox runtime configuration is unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/ledger-entries/integration-sync/financial-years",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ledger-entries/integration-sync/status": {
      "get": {
        "operationId": "integration_sync_status",
        "parameters": [
          {
            "description": "Response detail: 'full' (default) or 'summary'",
            "in": "query",
            "name": "detail",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationSyncStatusResponse"
                }
              }
            },
            "description": "Bookkeeping integration sync status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "detail must be 'full' or 'summary'",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ]
      }
    },
    "/api/v1/ledger-entries/voucher-series/suggest": {
      "post": {
        "operationId": "suggest_voucher_series",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoucherSeriesSuggestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoucherSeriesSuggestionResponse"
                }
              }
            },
            "description": "Suggested verification series",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/ledger-entries/voucher-series/suggest",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ledger-entries/voucher-series/{voucher_series}/latest": {
      "delete": {
        "operationId": "delete_latest_entry_in_voucher_series",
        "parameters": [
          {
            "description": "Voucher series whose latest voucher should be deleted",
            "in": "path",
            "name": "voucher_series",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Must be true to delete a posted/reversed voucher",
            "in": "query",
            "name": "confirm",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Latest voucher deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Voucher cannot be deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Confirmation is missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/ledger-entries/voucher-series/{voucher_series}/latest",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ledger-entries/{entry_id}/correct": {
      "post": {
        "operationId": "correct_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingEntryCorrectRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The correction entry (or staged operation) in a ledger write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be corrected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry state changed while correcting",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or staged-operation error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/ledger-entries/{entry_id}/correct",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ledger-entries/{entry_id}/export": {
      "post": {
        "operationId": "export_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Create a staged export operation instead of executing",
            "in": "query",
            "name": "stage",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "description": "Whether the staged export requires approval",
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Staged ledger export write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry is not exportable or no supported integration is connected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Direct export must use the reviewed integration sync workflow",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/ledger-entries/{entry_id}/export",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ledger-entries/{entry_id}/reverse": {
      "post": {
        "operationId": "reverse_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingEntryReverseRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The reversal entry (or staged operation) in a ledger write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be reversed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Ledger entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry state changed while reversing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or staged-operation error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/ledger-entries/{entry_id}/reverse",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ledger-entries/{id}": {
      "delete": {
        "operationId": "delete_entry_if_latest_in_series",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Must be true to delete a posted/reversed voucher",
            "in": "query",
            "name": "confirm",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Latest voucher deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Voucher cannot be deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Confirmation is missing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/ledger-entries/{id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "get": {
        "operationId": "get_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerEntryResponse"
                }
              }
            },
            "description": "The ledger entry",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ]
      }
    },
    "/api/v1/ledger-entries/{id}/chain": {
      "get": {
        "operationId": "get_entry_chain",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerEntryChainResponse"
                }
              }
            },
            "description": "The ledger entry and its reversal/correction chain",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ]
      }
    },
    "/api/v1/ledger-entries/{id}/date": {
      "patch": {
        "operationId": "update_entry_date",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LedgerDateUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Ledger entry date updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Date or entry status is invalid, or a period is locked/closed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry is controlled by an external provider",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/ledger-entries/{id}/date",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ledger-entries/{id}/description": {
      "patch": {
        "operationId": "update_entry_description",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LedgerDescriptionUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Ledger entry description updated",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Description or entry status is invalid",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry is controlled by an external provider",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/ledger-entries/{id}/description",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ledger-entries/{id}/draft": {
      "patch": {
        "operationId": "update_draft_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LedgerDraftUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Draft entry updated or staged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry cannot be edited",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry state conflicts with draft update",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/ledger-entries/{id}/draft",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ledger-entries/{id}/post": {
      "post": {
        "operationId": "post_entry",
        "parameters": [
          {
            "description": "Ledger entry UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerEntryResponse"
                }
              }
            },
            "description": "Entry posted; returns the hydrated entry",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry not postable (no lines, or unbalanced)",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Entry not in 'draft' status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Post a draft ledger entry.",
        "tags": [
          "ledger"
        ],
        "x-idempotency-debt-id": "POST /api/v1/ledger-entries/{id}/post",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/notifications": {
      "get": {
        "operationId": "list_notifications",
        "parameters": [
          {
            "description": "Max notifications to return (1\u2013100, default 20)",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Number of notifications to skip (default 0)",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationsResponse"
                }
              }
            },
            "description": "The company's notifications with unread/total counts",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "notifications"
        ]
      }
    },
    "/api/v1/notifications/read-all": {
      "post": {
        "operationId": "mark_all_notifications_read",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarkAllReadResponse"
                }
              }
            },
            "description": "Number of notifications marked read",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "notifications"
        ],
        "x-idempotency-debt-id": "POST /api/v1/notifications/read-all",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/notifications/{id}/read": {
      "post": {
        "operationId": "mark_notification_read",
        "parameters": [
          {
            "description": "Notification UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Notification marked read",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Notification not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "notifications"
        ],
        "x-idempotency-debt-id": "POST /api/v1/notifications/{id}/read",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/pipeline/cancel/{document_id}": {
      "post": {
        "operationId": "cancel_document",
        "parameters": [
          {
            "description": "Document UUID",
            "in": "path",
            "name": "document_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PipelineCancelResponse"
                }
              }
            },
            "description": "In-flight document pipeline was stopped",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No in-flight pipeline run to stop",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Gateway or repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "pipeline"
        ],
        "x-idempotency-debt-id": "POST /api/v1/pipeline/cancel/{document_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/pipeline/graph-definition": {
      "get": {
        "operationId": "graph_definition",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PipelineGraphDefinitionResponse"
                }
              }
            },
            "description": "LangGraph document pipeline topology for the Pipeline Builder UI",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "pipeline"
        ]
      }
    },
    "/api/v1/pipeline/rerun/{document_id}": {
      "post": {
        "operationId": "rerun_document",
        "parameters": [
          {
            "description": "Document UUID",
            "in": "path",
            "name": "document_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PipelineRerunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PipelineRerunResponse"
                }
              }
            },
            "description": "Document pipeline run was queued",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid requested pipeline stages",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Queue or repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "pipeline"
        ],
        "x-idempotency-debt-id": "POST /api/v1/pipeline/rerun/{document_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/pipeline/run-all": {
      "post": {
        "operationId": "run_all_uploaded",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PipelineRunAllRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PipelineRunAllResponse"
                }
              }
            },
            "description": "Matching documents were queued for pipeline processing",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid requested pipeline stages",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "pipeline"
        ],
        "x-idempotency-debt-id": "POST /api/v1/pipeline/run-all",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/pipeline/runs": {
      "get": {
        "operationId": "list_runs",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_PipelineRunResponse"
                }
              }
            },
            "description": "Company pipeline runs ordered by start time",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "pipeline"
        ]
      }
    },
    "/api/v1/pipeline/runs/by-document/{document_id}": {
      "get": {
        "operationId": "get_run_by_document",
        "parameters": [
          {
            "description": "Document UUID",
            "in": "path",
            "name": "document_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/PipelineRunResponse"
                    }
                  ]
                }
              }
            },
            "description": "Latest pipeline run for the document or null when no run exists",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid document_id format",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "pipeline"
        ]
      }
    },
    "/api/v1/pipeline/runs/by-process/{process_id}": {
      "get": {
        "operationId": "get_run_by_process",
        "parameters": [
          {
            "description": "Pipeline process ID",
            "in": "path",
            "name": "process_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/PipelineRunResponse"
                    }
                  ]
                }
              }
            },
            "description": "Pipeline run detail or null when the run record has not been created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid process_id format",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "pipeline"
        ]
      }
    },
    "/api/v1/pipeline/runs/{run_id}": {
      "get": {
        "operationId": "get_run_by_id",
        "parameters": [
          {
            "description": "Pipeline run ID",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PipelineRunResponse"
                }
              }
            },
            "description": "Pipeline run detail",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Pipeline run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "pipeline"
        ]
      }
    },
    "/api/v1/preview/entities": {
      "get": {
        "operationId": "get_entities",
        "parameters": [
          {
            "in": "query",
            "name": "table_key",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewEntityListResponse"
                }
              }
            },
            "description": "Active preview projection entities",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "preview"
        ]
      }
    },
    "/api/v1/preview/staged-operations": {
      "get": {
        "operationId": "get_staged_operations",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewStagedOperationListResponse"
                }
              }
            },
            "description": "Active staged operations with preview rows",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "preview"
        ]
      }
    },
    "/api/v1/preview/state": {
      "get": {
        "operationId": "get_state",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewStateOut"
                }
              }
            },
            "description": "Company preview projection state",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "preview"
        ]
      }
    },
    "/api/v1/profile": {
      "get": {
        "operationId": "get_profile",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileResponse"
                }
              }
            },
            "description": "Current user's own profile",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "profile"
        ]
      },
      "patch": {
        "operationId": "patch_profile",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProfileUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileResponse"
                }
              }
            },
            "description": "Updated current user's own profile",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid profile update",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "profile"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/profile",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/profile/onboarding-tour": {
      "patch": {
        "operationId": "patch_onboarding_tour",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OnboardingTourUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileResponse"
                }
              }
            },
            "description": "Updated guided-tour progress on the caller's profile",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid onboarding tour progress",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "profile"
        ],
        "x-idempotency-debt-id": "PATCH /api/v1/profile/onboarding-tour",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/ready": {
      "get": {
        "operationId": "ready",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReadyResponse"
                }
              }
            },
            "description": "",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Database pool cannot acquire",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "health"
        ]
      }
    },
    "/api/v1/reference-kb/company-documents": {
      "get": {
        "operationId": "list_company_documents",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_CompanyReferenceDocumentOut"
                }
              }
            },
            "description": "Company-uploaded reference documents",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reference-kb"
        ]
      },
      "post": {
        "operationId": "upload_company_document",
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyReferenceDocumentOut"
                }
              }
            },
            "description": "Company reference document uploaded",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid file upload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "File too large",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository, storage, or configuration error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reference-kb"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reference-kb/company-documents",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reference-kb/company-documents/{document_id}": {
      "delete": {
        "operationId": "delete_company_document",
        "parameters": [
          {
            "description": "Company reference document id",
            "in": "path",
            "name": "document_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Company reference document deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Knowledge-base document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or storage error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Search index deletion failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reference-kb"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/reference-kb/company-documents/{document_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reference-kb/health": {
      "get": {
        "operationId": "reference_kb_health",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReferenceKbHealthResponse"
                }
              }
            },
            "description": "Reference knowledge-base health",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reference-kb"
        ]
      }
    },
    "/api/v1/reference-kb/overview": {
      "get": {
        "operationId": "overview",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReferenceKbOverviewOut"
                }
              }
            },
            "description": "Reference KB overview with sources and company documents",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reference-kb"
        ]
      }
    },
    "/api/v1/reference-kb/search": {
      "post": {
        "operationId": "search_reference_kb",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReferenceSearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReferenceSearchResponse"
                }
              }
            },
            "description": "Reference knowledge-base search results",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Reference knowledge-base search failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reference-kb"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reference-kb/search",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reference-kb/sources": {
      "get": {
        "operationId": "list_reference_sources",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_ReferenceSourceOut"
                }
              }
            },
            "description": "Configured shared reference sources",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reference-kb"
        ]
      }
    },
    "/api/v1/reference/bas/versions": {
      "get": {
        "operationId": "bas_versions",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/BasDatasetVersion"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Versioned BAS reference dataset versions",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "chart-of-accounts"
        ]
      }
    },
    "/api/v1/reference/bas/{bas_version}/accounts/{account_number}/label": {
      "get": {
        "operationId": "bas_account_label",
        "parameters": [
          {
            "description": "BAS dataset version, e.g. 2026",
            "in": "path",
            "name": "bas_version",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "BAS account number",
            "in": "path",
            "name": "account_number",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Requested label language (sv|en); defaults to sv",
            "in": "query",
            "name": "lang",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelResolution"
                }
              }
            },
            "description": "Resolved label with fallback metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No label for this BAS version/account",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "chart-of-accounts"
        ]
      }
    },
    "/api/v1/reports/catalog": {
      "get": {
        "operationId": "report_catalog",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportCatalogResponse"
                }
              }
            },
            "description": "Static backend-owned report catalog",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/accruals": {
      "get": {
        "operationId": "list_accruals",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional fiscal period filter",
            "in": "query",
            "name": "fiscal_period_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "First-class accrual metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/accruals/post": {
      "post": {
        "operationId": "post_accruals",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccrualPostRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Posted accrual proposals in the public write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid accrual post request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/accruals/post",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/accruals/preview": {
      "post": {
        "operationId": "preview_accruals",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccrualPreviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Read-only accrual proposal preview",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid accrual preview request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/accruals/preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/accruals/reverse-due": {
      "post": {
        "operationId": "reverse_due_accruals",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccrualReverseDueRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Posted scheduled accrual reversals in the public write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid accrual reverse-due request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/accruals/reverse-due",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/accruals/reverse-due/stage": {
      "post": {
        "operationId": "stage_reverse_due_accruals",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccrualReverseDueStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged scheduled accrual reversals in the public write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid accrual reverse-due stage request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/accruals/reverse-due/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/accruals/stage": {
      "post": {
        "operationId": "stage_accruals",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccrualStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Staged accrual posting proposals in the public write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid accrual stage request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/accruals/stage",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/accruals/{accrual_id}": {
      "get": {
        "operationId": "get_accrual",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Accrual metadata row UUID",
            "in": "path",
            "name": "accrual_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "First-class accrual metadata row",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Accrual not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/audit-trail": {
      "get": {
        "operationId": "export_audit_trail",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Export format: json or csv",
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional audit event type filter",
            "in": "query",
            "name": "event_type",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional audited entity type filter",
            "in": "query",
            "name": "entity_type",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive created_at lower bound date",
            "in": "query",
            "name": "from_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Inclusive created_at upper bound date at midnight",
            "in": "query",
            "name": "to_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Maximum exported events, 1 through 50000",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Audit trail export",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid audit trail query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/balance-continuity": {
      "get": {
        "operationId": "balance_continuity",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period start",
            "in": "query",
            "name": "period_start",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period end",
            "in": "query",
            "name": "period_end",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Balance continuity report",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/balance-sheet": {
      "get": {
        "operationId": "balance_sheet",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Balance sheet date",
            "in": "query",
            "name": "as_of_date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Balance sheet report",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/customer-ledger": {
      "get": {
        "operationId": "customer_ledger",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Customer ledger aging date",
            "in": "query",
            "name": "as_of_date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer ledger aging report",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/customer-reconciliation": {
      "get": {
        "operationId": "customer_reconciliation",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Reconciliation date",
            "in": "query",
            "name": "as_of_date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer ledger to account 1510 reconciliation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/fixed-assets": {
      "get": {
        "operationId": "list_fixed_assets",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Fixed-asset register rows",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /reports/{company_id}/fixed-assets`. Lists the register for the SPA.",
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/fixed-assets/depreciation/post": {
      "post": {
        "operationId": "post_fixed_asset_depreciation",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetDepreciationPostRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Posted depreciation vouchers in the public write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid depreciation post request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fixed asset not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /reports/{company_id}/fixed-assets/depreciation/post`. Post the\ndepreciation due in a fiscal period for one asset.",
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/fixed-assets/depreciation/post",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/fixed-assets/detail/{asset_id}": {
      "get": {
        "operationId": "get_fixed_asset",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fixed asset UUID",
            "in": "path",
            "name": "asset_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Fixed-asset detail",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fixed asset not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`GET /reports/{company_id}/fixed-assets/detail/{asset_id}`. One asset with schedule + events.",
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/fixed-assets/disposal/post": {
      "post": {
        "operationId": "post_fixed_asset_disposal",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetDisposalRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Posted disposal voucher in the public write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid disposal request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fixed asset not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Asset already disposed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /reports/{company_id}/fixed-assets/disposal/post`. Post an asset disposal/sale.",
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/fixed-assets/disposal/post",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/fixed-assets/jamkning/post": {
      "post": {
        "operationId": "post_fixed_asset_jamkning",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetJamkningPostRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Posted j\u00e4mkning year in the public write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid j\u00e4mkning request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "J\u00e4mkning already posted for this year",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /reports/{company_id}/fixed-assets/jamkning/post`. Post a VAT j\u00e4mkning year.",
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/fixed-assets/jamkning/post",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/fixed-assets/jamkning/preview": {
      "post": {
        "operationId": "preview_fixed_asset_jamkning",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetJamkningPreviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "VAT j\u00e4mkning preview",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid j\u00e4mkning preview request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /reports/{company_id}/fixed-assets/jamkning/preview`. VAT j\u00e4mkning preview (item 2).",
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/fixed-assets/jamkning/preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/fixed-assets/overavskrivning/post": {
      "post": {
        "operationId": "post_fixed_asset_overavskrivning",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetOveravskrivningPostRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Posted \u00f6veravskrivning change in the public write-result envelope",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid \u00f6veravskrivning request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /reports/{company_id}/fixed-assets/overavskrivning/post`. Post the\nchange in the untaxed reserve (8853/2153) for a fiscal period.",
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/fixed-assets/overavskrivning/post",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/fixed-assets/reconcile": {
      "post": {
        "operationId": "reconcile_fixed_assets",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetReconcileRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Tie-out snapshots (acquisition + accumulated depreciation)",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid reconcile request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /reports/{company_id}/fixed-assets/reconcile`. Snapshot the subledger\u2192GL tie-out.",
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/fixed-assets/reconcile",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/fixed-assets/register": {
      "post": {
        "operationId": "register_fixed_asset",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetRegisterRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Registered fixed asset id",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid fixed-asset register request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /reports/{company_id}/fixed-assets/register`. Capitalize an asset.",
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/fixed-assets/register",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/fixed-assets/tax/preview": {
      "post": {
        "operationId": "preview_fixed_asset_tax",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedAssetTaxPreviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Tax-depreciation schedule for the asset",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid tax preview request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fixed asset not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "`POST /reports/{company_id}/fixed-assets/tax/preview`. Tax-depreciation schedule (item 4).",
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/fixed-assets/tax/preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/full-archive": {
      "get": {
        "operationId": "full_archive",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fiscal period UUID",
            "in": "query",
            "name": "period_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Include document index",
            "in": "query",
            "name": "include_documents",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Full fiscal-period archive ZIP",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/general-ledger": {
      "get": {
        "operationId": "general_ledger",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "BAS account number",
            "in": "query",
            "name": "account_number",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period start",
            "in": "query",
            "name": "period_start",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period end",
            "in": "query",
            "name": "period_end",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "General ledger account report",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/income-statement": {
      "get": {
        "operationId": "income_statement",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period start",
            "in": "query",
            "name": "period_start",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period end",
            "in": "query",
            "name": "period_end",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Income statement report",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/ink2": {
      "get": {
        "operationId": "ink2",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fiscal period UUID",
            "in": "query",
            "name": "period_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Response format: json or sru",
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "INK2 report JSON or SRU ZIP",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid INK2 request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      },
      "post": {
        "operationId": "ink2_post",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Ink2PostBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "INK2 report JSON or SRU ZIP with INK2S adjustments applied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid INK2 request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/ink2",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/ink3": {
      "get": {
        "operationId": "ink3",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fiscal period UUID",
            "in": "query",
            "name": "period_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Response format: json or sru",
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Membership fees (8650), not account-derived",
            "in": "query",
            "name": "medlemsavgifter",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Service fees (8651), not account-derived",
            "in": "query",
            "name": "serviceavgifter",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Gifts and grants (8652), not account-derived",
            "in": "query",
            "name": "gavor_bidrag",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "INK3R report JSON or SRU ZIP",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid INK3 request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "GET INK3R. With `format=sru` this streams a DRAFT/PREVIEW SRU download for a\n`Partial` (r\u00e4kenskapsschema-only) form \u2014 a convenience preview, not a filed\nartifact. The audited, retained filing artifact is produced through the\nreport-run POST path (`prepare_report_run` \u2192 `prepare_ink3_run`), which\nsnapshots the run, its rendered JSON, the SRU package, and rule-pack/BAS\nprovenance. Mirrors the established `GET .../ink2?format=sru` preview.",
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/ink4": {
      "get": {
        "operationId": "ink4",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fiscal period UUID",
            "in": "query",
            "name": "period_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Response format: json or sru",
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "INK4R report JSON or SRU ZIP",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid INK4 request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "GET INK4R. With `format=sru` this streams a DRAFT/PREVIEW SRU download for a\n`Partial` (r\u00e4kenskapsschema-only) form \u2014 a convenience preview, not a filed\nartifact. The audited, retained filing artifact is produced through the\nreport-run POST path (`prepare_report_run` \u2192 `prepare_ink4_run`), which\nsnapshots the run, its rendered JSON, the SRU package, and rule-pack/BAS\nprovenance. Mirrors the established `GET .../ink2?format=sru` preview.",
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/journal-register": {
      "get": {
        "operationId": "journal_register",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period start",
            "in": "query",
            "name": "period_start",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period end",
            "in": "query",
            "name": "period_end",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Journal register report",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/momsdeklaration": {
      "get": {
        "operationId": "momsdeklaration",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive VAT period start",
            "in": "query",
            "name": "period_start",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Inclusive VAT period end",
            "in": "query",
            "name": "period_end",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "VAT declaration report",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/monthly-breakdown": {
      "get": {
        "operationId": "monthly_breakdown",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period start",
            "in": "query",
            "name": "period_start",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period end",
            "in": "query",
            "name": "period_end",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monthly revenue and expense breakdown",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/ne-bilaga": {
      "get": {
        "operationId": "ne_bilaga",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fiscal period UUID",
            "in": "query",
            "name": "period_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Response format: json or sru",
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "NE-bilaga report JSON or SRU text",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid NE-bilaga request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/report-runs": {
      "get": {
        "operationId": "list_report_runs",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional report-type filter",
            "in": "query",
            "name": "report_type",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Maximum number of runs to return",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ReportRunSummary"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Report runs (newest first)",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      },
      "post": {
        "operationId": "prepare_report_run",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareReportRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportRunSummary"
                }
              }
            },
            "description": "Prepared report run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/report-runs",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/report-runs/{run_id}": {
      "get": {
        "operationId": "get_report_run",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Report run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportRunSummary"
                }
              }
            },
            "description": "Report run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Report run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/report-runs/{run_id}/approve": {
      "post": {
        "operationId": "approve_report_run",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Report run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportRunSummary"
                }
              }
            },
            "description": "Approved report run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Report run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/report-runs/{run_id}/approve",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/report-runs/{run_id}/transition": {
      "post": {
        "operationId": "transition_report_run",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Report run id",
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionReportRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportRunSummary"
                }
              }
            },
            "description": "Transitioned report run",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Illegal transition",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Report run not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/report-runs/{run_id}/transition",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/reporting-kpis": {
      "get": {
        "operationId": "reporting_kpis",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period start",
            "in": "query",
            "name": "period_start",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period end",
            "in": "query",
            "name": "period_end",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Derived reporting KPI summary",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/revaluation": {
      "post": {
        "operationId": "post_revaluation",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevaluationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Created or staged currency revaluation entries",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid revaluation request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/revaluation",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/supplier-ledger": {
      "get": {
        "operationId": "supplier_ledger",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Ledger aging date",
            "in": "query",
            "name": "as_of_date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Supplier ledger aging report",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/supplier-reconciliation": {
      "get": {
        "operationId": "supplier_reconciliation",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Reconciliation date",
            "in": "query",
            "name": "as_of_date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Supplier ledger to account 2440 reconciliation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/trial-balance": {
      "get": {
        "operationId": "trial_balance",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period start",
            "in": "query",
            "name": "period_start",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Inclusive report period end",
            "in": "query",
            "name": "period_end",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Trial balance report",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/vat-declaration": {
      "get": {
        "operationId": "vat_declaration",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "VAT period type: monthly, quarterly, or yearly",
            "in": "query",
            "name": "period_type",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "VAT period year, 2000-2100",
            "in": "query",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Month 1-12, quarter 1-4, or yearly marker",
            "in": "query",
            "name": "period",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Period-type VAT declaration report",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid period selector",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/vat-declaration/eskd": {
      "get": {
        "operationId": "vat_declaration_eskd",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "VAT period type: monthly, quarterly, or yearly",
            "in": "query",
            "name": "period_type",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "VAT period year, 2000-2100",
            "in": "query",
            "name": "year",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Month 1-12, quarter 1-4, or yearly marker",
            "in": "query",
            "name": "period",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Momsdeklaration eSKDUpload (v6.0) XML file for skatteverket.se",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid period selector or missing org number",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/year-end-close": {
      "post": {
        "operationId": "post_year_end_close",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/YearEndRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Executed or staged year-end close",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid year-end close request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ],
        "x-idempotency-debt-id": "POST /api/v1/reports/{company_id}/year-end-close",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/reports/{company_id}/year-end-preview": {
      "get": {
        "operationId": "year_end_preview",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fiscal period UUID",
            "in": "query",
            "name": "fiscal_period_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Year-end closing entry preview",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Closed fiscal period cannot be previewed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/reports/{company_id}/year-end-readiness": {
      "get": {
        "operationId": "year_end_readiness",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Fiscal period UUID",
            "in": "query",
            "name": "fiscal_period_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Year-end close readiness checks",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Fiscal period not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/api/v1/rules/standard-accounts": {
      "get": {
        "operationId": "standard_accounts",
        "parameters": [
          {
            "description": "Rule resolution date in RFC 3339 full-date format (`YYYY-MM-DD`).",
            "in": "query",
            "name": "as_of",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Company tenant UUID selected by the Clerk-authenticated caller",
            "in": "header",
            "name": "X-Company-Id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional diagnostic request ID returned on the response",
            "in": "header",
            "name": "X-Request-Id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StandardAccountsResponse"
                }
              }
            },
            "description": "Resolved Swedish standard account roles for the requested date",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid rule resolver request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "rules"
        ]
      }
    },
    "/api/v1/scb/_meta": {
      "get": {
        "operationId": "cert_metadata",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScbCertMetadataResponse"
                }
              }
            },
            "description": "SCB certificate metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "SCB lookup disabled or certificate metadata unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "scb"
        ]
      }
    },
    "/api/v1/scb/companies": {
      "get": {
        "operationId": "search_companies",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "minimum": 0,
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScbCompanySearchResponse"
                }
              }
            },
            "description": "SCB company search results",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid search query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Per-user SCB lookup rate limit exceeded",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "SCB upstream error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "SCB lookup disabled or not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "504": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "SCB upstream timeout",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "scb"
        ]
      }
    },
    "/api/v1/scb/companies/{org_nr}": {
      "get": {
        "operationId": "get_company",
        "parameters": [
          {
            "description": "10-digit org number, optionally dashed as YYMMDD-NNNN",
            "in": "path",
            "name": "org_nr",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScbCompanyResponse"
                }
              }
            },
            "description": "SCB company record",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid organization number",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Per-user SCB lookup rate limit exceeded",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "SCB upstream error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "SCB lookup disabled or not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "504": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "SCB upstream timeout",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "scb"
        ]
      }
    },
    "/api/v1/settings": {
      "get": {
        "operationId": "get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserSettingsResponse"
                }
              }
            },
            "description": "Current user settings",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "User not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "settings"
        ]
      },
      "put": {
        "operationId": "update",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserSettingsResponse"
                }
              }
            },
            "description": "Updated user settings",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid settings request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "User not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "settings"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/settings",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/sie/{company_id}/export": {
      "get": {
        "operationId": "export_sie4",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive fiscal year start",
            "in": "query",
            "name": "year_start",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Inclusive fiscal year end",
            "in": "query",
            "name": "year_end",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SIE4 file export",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sie"
        ]
      }
    },
    "/api/v1/sie/{company_id}/exports": {
      "get": {
        "operationId": "list_sie_exports",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Maximum number of export artifacts to return",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieExportArtifactListResponse"
                }
              }
            },
            "description": "Retained SIE export artifacts",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sie"
        ]
      }
    },
    "/api/v1/sie/{company_id}/exports/{artifact_id}": {
      "get": {
        "operationId": "show_sie_export",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "SIE export artifact id",
            "in": "path",
            "name": "artifact_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieExportArtifactSummary"
                }
              }
            },
            "description": "SIE export artifact metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Export artifact not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sie"
        ]
      }
    },
    "/api/v1/sie/{company_id}/exports/{artifact_id}/download": {
      "get": {
        "operationId": "download_sie_export",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "SIE export artifact id",
            "in": "path",
            "name": "artifact_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained SIE export bytes",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Export artifact not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sie"
        ]
      }
    },
    "/api/v1/sie/{company_id}/imports": {
      "get": {
        "operationId": "list_sie_imports",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Maximum number of plans to return",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieImportPlanListResponse"
                }
              }
            },
            "description": "SIE import plans",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sie"
        ]
      }
    },
    "/api/v1/sie/{company_id}/imports/preview": {
      "post": {
        "operationId": "preview_sie_import",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieImportPreviewResponse"
                }
              }
            },
            "description": "SIE import preview staged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid SIE upload",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sie"
        ],
        "x-idempotency-debt-id": "POST /api/v1/sie/{company_id}/imports/preview",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/sie/{company_id}/imports/{staged_operation_id}": {
      "get": {
        "operationId": "show_sie_import",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Staged SIE import plan id",
            "in": "path",
            "name": "staged_operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieImportPlanDetailResponse"
                }
              }
            },
            "description": "SIE import plan detail",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Import plan not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sie"
        ]
      }
    },
    "/api/v1/sie/{company_id}/imports/{staged_operation_id}/apply": {
      "post": {
        "operationId": "apply_sie_import",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Staged SIE import plan id",
            "in": "path",
            "name": "staged_operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieImportApplyResponse"
                }
              }
            },
            "description": "SIE import plan applied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Import plan is blocked or invalid",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Import plan not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sie"
        ],
        "x-idempotency-debt-id": "POST /api/v1/sie/{company_id}/imports/{staged_operation_id}/apply",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/sie/{company_id}/imports/{staged_operation_id}/artifact-metadata": {
      "get": {
        "operationId": "show_sie_import_artifact_metadata",
        "parameters": [
          {
            "description": "Company UUID from the legacy public path",
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Staged SIE import plan id",
            "in": "path",
            "name": "staged_operation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SieImportArtifactMetadataResponse"
                }
              }
            },
            "description": "SIE import artifact metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company membership is required",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Import artifact not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sie"
        ]
      }
    },
    "/api/v1/staged-operations": {
      "get": {
        "operationId": "list",
        "parameters": [
          {
            "description": "Filter to operations with this status (`staged`, `approved`,\n`rejected`, `executed`, `failed`, `cancelled`).",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Filter to operations with this operation_key (e.g.\n`ledger_entries.post`, `bank_matching.approve`). Maps onto the\n`operation` query param the Python route exposes - same name\nthe CLI / agents already send.",
            "in": "query",
            "name": "operation",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "description": "Filter to operations whose `requires_approval` flag matches.",
            "in": "query",
            "name": "requires_approval",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "description": "Max rows returned. Clamped to 1..=500 at the route layer.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StagedOperationListResponse"
                }
              }
            },
            "description": "List of staged operations for the company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "staged-operations"
        ]
      },
      "post": {
        "operationId": "create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStagedOperationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateStagedOperationResponse"
                }
              }
            },
            "description": "Idempotency-key replay - existing operation returned",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateStagedOperationResponse"
                }
              }
            },
            "description": "New staged operation created",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid payload (e.g. empty `operation`)",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Create a staged operation. Idempotency-key replay returns the existing\noperation with `replayed: true` and a `200 OK`; a fresh insert returns the\nnew operation with `replayed: false` and a `201 Created`.",
        "tags": [
          "staged-operations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/staged-operations",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/staged-operations/{id}": {
      "get": {
        "operationId": "get_by_id",
        "parameters": [
          {
            "description": "Staged operation UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StagedOperationResponse"
                }
              }
            },
            "description": "The staged operation",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Operation not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "staged-operations"
        ]
      }
    },
    "/api/v1/staged-operations/{id}/approve": {
      "post": {
        "operationId": "approve",
        "parameters": [
          {
            "description": "Staged operation UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StagedOperationResponse"
                }
              }
            },
            "description": "Operation approved",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Operation not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Operation isn't in 'staged' or 'approved' status",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Approve a staged operation.",
        "tags": [
          "staged-operations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/staged-operations/{id}/approve",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/staged-operations/{id}/execute": {
      "post": {
        "operationId": "execute",
        "parameters": [
          {
            "description": "Staged operation UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecuteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StagedOperationResponse"
                }
              }
            },
            "description": "Operation marked executed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Operation not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Operation isn't approved (when required) or already rejected/cancelled",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Mark a staged operation as executed. The caller's\n`audit_event_ids` list, `result`, `execution_reference_type`, and\n`execution_reference_id` are persisted by Rust.",
        "tags": [
          "staged-operations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/staged-operations/{id}/execute",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/staged-operations/{id}/fail": {
      "post": {
        "operationId": "fail",
        "parameters": [
          {
            "description": "Staged operation UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FailureRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StagedOperationResponse"
                }
              }
            },
            "description": "Operation marked failed, or existing failed operation returned unchanged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Operation not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Operation is executed, rejected, or cancelled",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Mark a staged or approved operation as failed. Repeating a failure returns\nthe original failed operation unchanged; other terminal states conflict.",
        "tags": [
          "staged-operations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/staged-operations/{id}/fail",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/staged-operations/{id}/reject": {
      "post": {
        "operationId": "reject",
        "parameters": [
          {
            "description": "Staged operation UUID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StagedOperationResponse"
                }
              }
            },
            "description": "Operation rejected",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Operation not found in this company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Operation is already executed / failed / cancelled",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Reject a staged operation.",
        "tags": [
          "staged-operations"
        ],
        "x-idempotency-debt-id": "POST /api/v1/staged-operations/{id}/reject",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/supplier-rules/{supplier_id}": {
      "delete": {
        "operationId": "disable_supplier_rule",
        "parameters": [
          {
            "description": "Supplier UUID",
            "in": "path",
            "name": "supplier_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Rule disabled",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Supplier not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "supplier-rules"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/supplier-rules/{supplier_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "get": {
        "operationId": "get_supplier_rule",
        "parameters": [
          {
            "description": "Supplier UUID",
            "in": "path",
            "name": "supplier_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierRuleResponse"
                }
              }
            },
            "description": "Current rule state",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Supplier not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "supplier-rules"
        ]
      }
    },
    "/api/v1/supplier-rules/{supplier_id}/confirm": {
      "post": {
        "operationId": "confirm_supplier_rule",
        "parameters": [
          {
            "description": "Supplier UUID",
            "in": "path",
            "name": "supplier_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmSupplierRuleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmSupplierRuleResponse"
                }
              }
            },
            "description": "Rule confirmed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Supplier not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "supplier-rules"
        ],
        "x-idempotency-debt-id": "POST /api/v1/supplier-rules/{supplier_id}/confirm",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/supplier-rules/{supplier_id}/suggestion": {
      "get": {
        "operationId": "get_supplier_rule_suggestion",
        "parameters": [
          {
            "description": "Supplier UUID",
            "in": "path",
            "name": "supplier_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierRuleSuggestionResponse"
                }
              }
            },
            "description": "Rule suggestion",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "supplier-rules"
        ]
      }
    },
    "/api/v1/sync/fortnox/start": {
      "post": {
        "operationId": "start",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FortnoxSyncStartRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Fortnox sync started or staged",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Sync is already running",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Repository or staging error",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sync"
        ],
        "x-idempotency-debt-id": "POST /api/v1/sync/fortnox/start",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/sync/fortnox/status": {
      "get": {
        "operationId": "sync_status",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_FortnoxSyncStatusResponse"
                }
              }
            },
            "description": "Fortnox sync status rows for the company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sync"
        ]
      }
    },
    "/api/v1/sync/ledger/accounts": {
      "get": {
        "operationId": "list_accounts",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_ChartAccountResponse"
                }
              }
            },
            "description": "Effective company chart of accounts",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sync-ledger"
        ]
      }
    },
    "/api/v1/sync/ledger/cost-centers": {
      "get": {
        "operationId": "list_cost_centers",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_SyncCostCenterResponse"
                }
              }
            },
            "description": "Active Fortnox cost centers ordered by code",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sync-ledger"
        ]
      }
    },
    "/api/v1/sync/ledger/projects": {
      "get": {
        "operationId": "list_projects",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_SyncProjectResponse"
                }
              }
            },
            "description": "Fortnox projects ordered by project number",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sync-ledger"
        ]
      }
    },
    "/api/v1/sync/ledger/suppliers": {
      "get": {
        "operationId": "search_suppliers",
        "parameters": [
          {
            "in": "query",
            "name": "name",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_SyncSupplierResponse"
                }
              }
            },
            "description": "Company suppliers ordered by name",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "sync-ledger"
        ]
      }
    },
    "/api/v1/time-entries": {
      "get": {
        "operationId": "list_entries",
        "parameters": [
          {
            "in": "query",
            "name": "date_from",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "required": false,
            "schema": {
              "format": "date",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "client_company_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_TimeEntryResponse"
                }
              }
            },
            "description": "User time entries",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "time-tracking"
        ]
      },
      "post": {
        "operationId": "create_entry",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimeEntryCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeEntryResponse"
                }
              }
            },
            "description": "Created time entry",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "time-tracking"
        ],
        "x-idempotency-debt-id": "POST /api/v1/time-entries",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/time-entries/create-invoice": {
      "post": {
        "operationId": "create_invoice_from_entries",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvoiceFromEntriesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateInvoiceFromEntriesResponse"
                }
              }
            },
            "description": "Created invoice from time entries",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "No valid time entries found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company access denied",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "time-tracking"
        ],
        "x-idempotency-debt-id": "POST /api/v1/time-entries/create-invoice",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/time-entries/meta": {
      "get": {
        "operationId": "meta",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeTrackingMetaResponse"
                }
              }
            },
            "description": "Time tracking metadata",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "time-tracking"
        ]
      }
    },
    "/api/v1/time-entries/parse": {
      "post": {
        "operationId": "parse_natural_language",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NaturalLanguageParseRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NaturalLanguageParseResponse"
                }
              }
            },
            "description": "Parsed natural language time entry",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Natural language parsing failed",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "time-tracking"
        ],
        "x-idempotency-debt-id": "POST /api/v1/time-entries/parse",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/time-entries/timer/current": {
      "get": {
        "operationId": "get_current_timer",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/TimeEntryResponse"
                    }
                  ]
                }
              }
            },
            "description": "Current running timer or null",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "time-tracking"
        ]
      }
    },
    "/api/v1/time-entries/timer/start": {
      "post": {
        "operationId": "start_timer",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimerStartRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeEntryResponse"
                }
              }
            },
            "description": "Started timer",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "time-tracking"
        ],
        "x-idempotency-debt-id": "POST /api/v1/time-entries/timer/start",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/time-entries/timer/stop": {
      "post": {
        "operationId": "stop_timer",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/TimeEntryResponse"
                    }
                  ]
                }
              }
            },
            "description": "Stopped timer or null when none is running",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "time-tracking"
        ],
        "x-idempotency-debt-id": "POST /api/v1/time-entries/timer/stop",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/time-entries/{entry_id}": {
      "delete": {
        "operationId": "delete_entry",
        "parameters": [
          {
            "description": "Time entry id",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Time entry deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Time entry not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "time-tracking"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/time-entries/{entry_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "put": {
        "operationId": "update_entry",
        "parameters": [
          {
            "description": "Time entry id",
            "in": "path",
            "name": "entry_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimeEntryUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeEntryResponse"
                }
              }
            },
            "description": "Updated time entry",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Time entry not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "time-tracking"
        ],
        "x-idempotency-debt-id": "PUT /api/v1/time-entries/{entry_id}",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/uploads/confirm": {
      "post": {
        "operationId": "confirm_upload",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadConfirmRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadConfirmResponse"
                }
              }
            },
            "description": "Upload confirmation result",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid upload confirmation state",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Document not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "uploads"
        ],
        "x-idempotency-debt-id": "POST /api/v1/uploads/confirm",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/uploads/known-hashes": {
      "get": {
        "operationId": "known_hashes",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiList_String"
                }
              }
            },
            "description": "Known non-deleted document file hashes for the company",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "uploads"
        ]
      }
    },
    "/api/v1/uploads/presign": {
      "post": {
        "operationId": "presign_upload",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadPresignRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadPresignResponse"
                }
              }
            },
            "description": "Presigned upload URL",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Unsupported upload request",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Upload storage unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "uploads"
        ],
        "x-idempotency-debt-id": "POST /api/v1/uploads/presign",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/uploads/reconcile": {
      "post": {
        "operationId": "reconcile_uploads",
        "parameters": [
          {
            "description": "dry_run (default) or apply",
            "in": "query",
            "name": "mode",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadReconcileResponse"
                }
              }
            },
            "description": "Stranded-upload reconcile summary",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Object storage unavailable",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "uploads"
        ],
        "x-idempotency-debt-id": "POST /api/v1/uploads/reconcile",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      }
    },
    "/api/v1/usage/company": {
      "get": {
        "operationId": "company_usage",
        "parameters": [
          {
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyUsageResponse"
                }
              }
            },
            "description": "Company LLM usage",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Company not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "usage"
        ]
      }
    },
    "/api/v1/usage/me": {
      "get": {
        "operationId": "user_usage",
        "parameters": [
          {
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserUsageResponse"
                }
              }
            },
            "description": "Current user LLM usage",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid query",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "usage"
        ]
      }
    },
    "/api/v1/users/me": {
      "delete": {
        "operationId": "delete_account",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteAccountResponse"
                }
              }
            },
            "description": "Account deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Invalid confirmation code",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "User not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Deletion challenge secret is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "users"
        ],
        "x-idempotency-debt-id": "DELETE /api/v1/users/me",
        "x-idempotency-explanation": "Existing mutating route predates platform idempotency; see docs/api-contract-debt.json.",
        "x-idempotency-policy": "deferred"
      },
      "get": {
        "operationId": "me",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserProfileResponse"
                }
              }
            },
            "description": "Current user profile",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "User not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "users"
        ]
      }
    },
    "/api/v1/users/me/deletion-info": {
      "get": {
        "operationId": "deletion_info",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionInfoResponse"
                }
              }
            },
            "description": "Account deletion impact and confirmation challenge",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "User not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Deletion challenge secret is not configured",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "users"
        ]
      }
    },
    "/api/v1/users/me/export": {
      "get": {
        "operationId": "export_account_data",
        "responses": {
          "200": {
            "description": "ZIP archive containing current user account data",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "Missing or invalid auth",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorBody"
                }
              }
            },
            "description": "User not found",
            "headers": {
              "X-Request-Id": {
                "description": "Diagnostic request ID returned on every response.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "users"
        ]
      }
    }
  },
  "tags": [
    {
      "description": "Public signed auth lifecycle webhooks",
      "name": "auth"
    },
    {
      "description": "Service liveness and readiness",
      "name": "health"
    },
    {
      "description": "Accounting entry support routes",
      "name": "accounting-entries"
    },
    {
      "description": "Provider-backed accounting flow rule-set routes",
      "name": "accounting-flows"
    },
    {
      "description": "Accounting hub UI read models",
      "name": "accounting-hub"
    },
    {
      "description": "Company automation package metadata routes",
      "name": "automations"
    },
    {
      "description": "Deterministic bank matching lifecycle routes",
      "name": "bank-matching"
    },
    {
      "description": "Company bank transaction support routes",
      "name": "bank-transactions"
    },
    {
      "description": "Bookkeeping-specific read models",
      "name": "bookkeeping"
    },
    {
      "description": "Company card automation rules",
      "name": "card-rules"
    },
    {
      "description": "Effective company chart of accounts",
      "name": "chart-of-accounts"
    },
    {
      "description": "Effective-dated accounting rule resolver reads",
      "name": "rules"
    },
    {
      "description": "Dashboard read models",
      "name": "dashboard"
    },
    {
      "description": "Company document read models",
      "name": "documents"
    },
    {
      "description": "Employee support routes",
      "name": "employees"
    },
    {
      "description": "Current user settings",
      "name": "settings"
    },
    {
      "description": "LLM token usage analytics",
      "name": "usage"
    },
    {
      "description": "Current user profile and account routes",
      "name": "users"
    },
    {
      "description": "Company profile and team reads",
      "name": "companies"
    },
    {
      "description": "Company-scoped ledger entry reads and posting",
      "name": "ledger"
    },
    {
      "description": "Private staged-operation state machine",
      "name": "staged-operations"
    },
    {
      "description": "Private backing routes for igdrasil-cli accounting hub register commands",
      "name": "cli-accounting-hub"
    },
    {
      "description": "Private backing routes for existing igdrasil-cli bank contracts",
      "name": "cli-bank"
    },
    {
      "description": "Private backing routes for igdrasil-cli chart-of-accounts commands",
      "name": "cli-chart-of-accounts"
    },
    {
      "description": "User-authenticated igdrasil-cli schema contract",
      "name": "cli-schema"
    },
    {
      "description": "Private fiscal period list and lock state",
      "name": "fiscal-periods"
    },
    {
      "description": "Private Fortnox source-control review state",
      "name": "fortnox-source-control"
    },
    {
      "description": "Private Fortnox sync job execution",
      "name": "fortnox-sync"
    },
    {
      "description": "Email inbox setup and allowlist routes",
      "name": "email-inbox"
    },
    {
      "description": "Integration management status routes",
      "name": "integrations"
    },
    {
      "description": "Public sync status and control routes",
      "name": "sync"
    },
    {
      "description": "Public sync ledger support reads",
      "name": "sync-ledger"
    },
    {
      "description": "Reference knowledge-base status",
      "name": "reference-kb"
    },
    {
      "description": "Skatteverket knowledge-base status",
      "name": "skatteverket-kb"
    },
    {
      "description": "Upload support reads",
      "name": "uploads"
    },
    {
      "description": "User-scoped document pipeline metadata",
      "name": "pipeline"
    },
    {
      "description": "Global preview projection read models",
      "name": "preview"
    },
    {
      "description": "SCB lookup diagnostics",
      "name": "scb"
    },
    {
      "description": "SIE file import and export routes",
      "name": "sie"
    },
    {
      "description": "Time tracking read and write routes",
      "name": "time-tracking"
    }
  ]
}
